File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 6
6
#include < stdlib.h>
7
7
8
8
#define LOG (msg ) printf(" %s\n " ,msg);
9
- #define TRACE (msg ) // printf(%s\n, msg);
9
+ #define TRACE (msg ) // printf(" %s\n" , msg);
10
10
11
11
12
12
#define THROW (msg ) return ThrowException(Exception::Error(String::New(msg)));
@@ -251,6 +251,7 @@ class Connection : public ObjectWrap {
251
251
bool copyInMode_;
252
252
bool reading_;
253
253
bool writing_;
254
+ bool ended_;
254
255
Connection () : ObjectWrap ()
255
256
{
256
257
connection_ = NULL ;
@@ -260,6 +261,7 @@ class Connection : public ObjectWrap {
260
261
copyInMode_ = false ;
261
262
reading_ = false ;
262
263
writing_ = false ;
264
+ ended_ = false ;
263
265
TRACE (" Initializing ev watchers" );
264
266
read_watcher_.data = this ;
265
267
write_watcher_.data = this ;
@@ -369,6 +371,7 @@ class Connection : public ObjectWrap {
369
371
// and hands off control to libev
370
372
bool Connect (const char * conninfo)
371
373
{
374
+ if (ended_) return true ;
372
375
connection_ = PQconnectStart (conninfo);
373
376
374
377
if (!connection_) {
@@ -660,6 +663,7 @@ class Connection : public ObjectWrap {
660
663
StopWrite ();
661
664
DestroyConnection ();
662
665
Emit (" _end" );
666
+ ended_ = true ;
663
667
}
664
668
665
669
private:
Original file line number Diff line number Diff line change
1
+ //test for issue #320
2
+ //
3
+ var helper = require ( './test-helper' ) ;
4
+
5
+ var client = new helper . pg . Client ( helper . config ) ;
6
+ client . connect ( ) ;
7
+ client . end ( ) ;
You can’t perform that action at this time.
0 commit comments