Browse Source

rename Connection.disconnect -> Connection.close

v0.7.4-release
Ryan 16 years ago
parent
commit
bb6057d9ad
  1. 8
      src/net.cc
  2. 6
      src/net.h
  3. 4
      test/test-pingpong.js

8
src/net.cc

@ -54,7 +54,7 @@ Connection::Initialize (v8::Handle<v8::Object> target)
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);
}
@ -169,7 +169,7 @@ Connection::v8Connect (const Arguments& args)
* http://lists.schmorp.de/pipermail/libev/2009q1/000632.html
*/
eio_warmup();
eio_req *req = eio_custom( Connection::Resolve
eio_custom( Connection::Resolve
, EIO_PRI_DEFAULT
, Connection::AfterResolve
, connection
@ -221,11 +221,11 @@ Connection::AfterResolve (eio_req *req)
}
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();
}

6
src/net.h

@ -13,7 +13,7 @@ public:
Connection (v8::Handle<v8::Object> handle);
~Connection () {
Disconnect();
Close();
}
int Connect (struct addrinfo *address) {
@ -28,7 +28,7 @@ public:
oi_socket_write_eof (&socket_);
}
void Disconnect (void) {
void Close (void) {
oi_socket_close (&socket_);
}
@ -37,7 +37,7 @@ protected:
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);

4
test/test-pingpong.js

@ -1,7 +1,7 @@
include("mjsunit");
var port = 12123;
var N = 100;
var N = 1000;
var count = 0;
function Ponger (socket, server) {
@ -23,7 +23,7 @@ function Ponger (socket, server) {
this.onEOF = function () {
puts("ponger: onEOF");
socket.send("QUIT");
socket.sendEOF();
socket.close();
};
this.onDisconnect = function () {

Loading…
Cancel
Save