tcp_connection_constructor = Persistent<Function>::New(t->GetFunction());
NODE_SET_METHOD(t->InstanceTemplate(), "connect", Connection::v8Connect);
- NODE_SET_METHOD(t->InstanceTemplate(), "disconnect", Connection::v8Disconnect);
+ NODE_SET_METHOD(t->InstanceTemplate(), "close", Connection::v8Close);
NODE_SET_METHOD(t->InstanceTemplate(), "send", Connection::v8Send);
NODE_SET_METHOD(t->InstanceTemplate(), "sendEOF", Connection::v8SendEOF);
}
* http://lists.schmorp.de/pipermail/libev/2009q1/000632.html
*/
eio_warmup();
- eio_req *req = eio_custom( Connection::Resolve
- , EIO_PRI_DEFAULT
- , Connection::AfterResolve
- , connection
- );
+ eio_custom( Connection::Resolve
+ , EIO_PRI_DEFAULT
+ , Connection::AfterResolve
+ , connection
+ );
return Undefined();
}
}
Handle<Value>
-Connection::v8Disconnect (const Arguments& args)
+Connection::v8Close (const Arguments& args)
{
HandleScope scope;
Connection *connection = NODE_UNWRAP(Connection, args.Holder());
- connection->Disconnect();
+ connection->Close();
return Undefined();
}
Connection (v8::Handle<v8::Object> handle);
~Connection () {
- Disconnect();
+ Close();
}
int Connect (struct addrinfo *address) {
oi_socket_write_eof (&socket_);
}
- void Disconnect (void) {
+ void Close (void) {
oi_socket_close (&socket_);
}
static v8::Handle<v8::Value> v8Connect (const v8::Arguments& args);
static v8::Handle<v8::Value> v8Send (const v8::Arguments& args);
static v8::Handle<v8::Value> v8SendEOF (const v8::Arguments& args);
- static v8::Handle<v8::Value> v8Disconnect (const v8::Arguments& args);
+ static v8::Handle<v8::Value> v8Close (const v8::Arguments& args);
void OnConnect (void);
void OnReceive (const void *buf, size_t len);
include("mjsunit");
var port = 12123;
-var N = 100;
+var N = 1000;
var count = 0;
function Ponger (socket, server) {
this.onEOF = function () {
puts("ponger: onEOF");
socket.send("QUIT");
- socket.sendEOF();
+ socket.close();
};
this.onDisconnect = function () {