Fix native quick disconnect hang
Do not initialize connection if connection has been ended
This commit is contained in:
parent
12cc7d53d8
commit
75181492f2
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user