commit
300e70c630
@ -6,7 +6,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LOG(msg) printf("%s\n",msg);
|
||||
#define TRACE(msg) //printf(%s\n, msg);
|
||||
#define TRACE(msg) //printf("%s\n", msg);
|
||||
|
||||
|
||||
#define THROW(msg) return ThrowException(Exception::Error(String::New(msg)));
|
||||
@ -251,6 +251,7 @@ public:
|
||||
bool copyInMode_;
|
||||
bool reading_;
|
||||
bool writing_;
|
||||
bool ended_;
|
||||
Connection () : ObjectWrap ()
|
||||
{
|
||||
connection_ = NULL;
|
||||
@ -260,6 +261,7 @@ public:
|
||||
copyInMode_ = false;
|
||||
reading_ = false;
|
||||
writing_ = false;
|
||||
ended_ = false;
|
||||
TRACE("Initializing ev watchers");
|
||||
read_watcher_.data = this;
|
||||
write_watcher_.data = this;
|
||||
@ -369,6 +371,7 @@ protected:
|
||||
//and hands off control to libev
|
||||
bool Connect(const char* conninfo)
|
||||
{
|
||||
if(ended_) return true;
|
||||
connection_ = PQconnectStart(conninfo);
|
||||
|
||||
if (!connection_) {
|
||||
@ -660,6 +663,7 @@ protected:
|
||||
StopWrite();
|
||||
DestroyConnection();
|
||||
Emit("_end");
|
||||
ended_ = true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
7
test/integration/client/quick-disconnect-tests.js
Normal file
7
test/integration/client/quick-disconnect-tests.js
Normal file
@ -0,0 +1,7 @@
|
||||
//test for issue #320
|
||||
//
|
||||
var helper = require('./test-helper');
|
||||
|
||||
var client = new helper.pg.Client(helper.config);
|
||||
client.connect();
|
||||
client.end();
|
Loading…
Reference in New Issue
Block a user