File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 66#include < stdlib.h>
77
88#define LOG (msg ) printf(" %s\n " ,msg);
9- #define TRACE (msg ) // printf(%s\n, msg);
9+ #define TRACE (msg ) // printf(" %s\n" , msg);
1010
1111
1212#define THROW (msg ) return ThrowException(Exception::Error(String::New(msg)));
@@ -251,6 +251,7 @@ class Connection : public ObjectWrap {
251251 bool copyInMode_;
252252 bool reading_;
253253 bool writing_;
254+ bool ended_;
254255 Connection () : ObjectWrap ()
255256 {
256257 connection_ = NULL ;
@@ -260,6 +261,7 @@ class Connection : public ObjectWrap {
260261 copyInMode_ = false ;
261262 reading_ = false ;
262263 writing_ = false ;
264+ ended_ = false ;
263265 TRACE (" Initializing ev watchers" );
264266 read_watcher_.data = this ;
265267 write_watcher_.data = this ;
@@ -369,6 +371,7 @@ class Connection : public ObjectWrap {
369371 // and hands off control to libev
370372 bool Connect (const char * conninfo)
371373 {
374+ if (ended_) return true ;
372375 connection_ = PQconnectStart (conninfo);
373376
374377 if (!connection_) {
@@ -660,6 +663,7 @@ class Connection : public ObjectWrap {
660663 StopWrite ();
661664 DestroyConnection ();
662665 Emit (" _end" );
666+ ended_ = true ;
663667 }
664668
665669private:
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