mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Fix for issue #165. Use libuv events instead of libev events.
This commit is contained in:
parent
9341efe669
commit
175d18dce7
@ -78,11 +78,18 @@ public:
|
||||
TRACE("created class");
|
||||
}
|
||||
|
||||
//static function called by libev as callback entrypoint
|
||||
//static function called by libuv as callback entrypoint
|
||||
static void
|
||||
io_event(uv_poll_t* w, int status, int revents)
|
||||
{
|
||||
|
||||
TRACE("Received IO event");
|
||||
|
||||
if(status == -1) {
|
||||
LOG("Connection error.");
|
||||
return;
|
||||
}
|
||||
|
||||
Connection *connection = static_cast<Connection*>(w->data);
|
||||
connection->HandleIOEvent(revents);
|
||||
}
|
||||
@ -379,13 +386,9 @@ protected:
|
||||
Emit("notice", ¬ice);
|
||||
}
|
||||
|
||||
//called to process io_events from libev
|
||||
//called to process io_events from libuv
|
||||
void HandleIOEvent(int revents)
|
||||
{
|
||||
if(revents & EV_ERROR) {
|
||||
LOG("Connection error.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(connecting_) {
|
||||
TRACE("Processing connecting_ io");
|
||||
@ -393,8 +396,8 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
if(revents & EV_READ) {
|
||||
TRACE("revents & EV_READ");
|
||||
if(revents & UV_READABLE) {
|
||||
TRACE("revents & UV_READABLE");
|
||||
if(PQconsumeInput(connection_) == 0) {
|
||||
End();
|
||||
EmitLastError();
|
||||
@ -402,7 +405,7 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
//declare handlescope as this method is entered via a libev callback
|
||||
//declare handlescope as this method is entered via a libuv callback
|
||||
//and not part of the public v8 interface
|
||||
HandleScope scope;
|
||||
|
||||
@ -432,8 +435,8 @@ protected:
|
||||
|
||||
}
|
||||
|
||||
if(revents & EV_WRITE) {
|
||||
TRACE("revents & EV_WRITE");
|
||||
if(revents & UV_WRITABLE) {
|
||||
TRACE("revents & UV_WRITABLE");
|
||||
if (PQflush(connection_) == 0) {
|
||||
StopWrite();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user