mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
oops. call onConnect callback not onRead callback after connecting
This commit is contained in:
parent
1542fc6a0b
commit
140a032894
@ -171,12 +171,14 @@ Socket::AfterResolve (eio_req *req)
|
||||
{
|
||||
Socket *socket = static_cast<Socket*> (req->data);
|
||||
struct addrinfo *address = static_cast<struct addrinfo *>(req->ptr2);
|
||||
req->ptr2 = NULL;
|
||||
|
||||
int r = 0;
|
||||
if (req->result == 0) {
|
||||
r = oi_socket_connect (&socket->socket_, address);
|
||||
}
|
||||
freeaddrinfo(address); // this was allocated in the thread pool
|
||||
if (address)
|
||||
freeaddrinfo(address);
|
||||
|
||||
// no error. return.
|
||||
if(r == 0 && req->result == 0) {
|
||||
@ -185,7 +187,7 @@ Socket::AfterResolve (eio_req *req)
|
||||
}
|
||||
|
||||
HandleScope scope;
|
||||
Handle<Value> onconnect_value = socket->handle_->Get(ON_READ_SYMBOL);
|
||||
Handle<Value> onconnect_value = socket->handle_->Get(ON_CONNECT_SYMBOL);
|
||||
if (!onconnect_value->IsFunction()) return 0;
|
||||
Handle<Function> onconnect = Handle<Function>::Cast(onconnect_value);
|
||||
|
||||
@ -408,6 +410,8 @@ Socket::OnTimeout (oi_socket *s)
|
||||
Socket *socket = static_cast<Socket*> (s->data);
|
||||
HandleScope scope;
|
||||
|
||||
printf("timeout\n");
|
||||
|
||||
Handle<Value> ontimeout_value = socket->handle_->Get( String::NewSymbol("onTimeout") );
|
||||
if (!ontimeout_value->IsFunction()) return;
|
||||
Handle<Function> ontimeout = Handle<Function>::Cast(ontimeout_value);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user