From: Ryan Dahl Date: Sun, 21 Feb 2010 06:38:42 +0000 (-0800) Subject: Rename readPause and readResume to pause/resume X-Git-Tag: v0.1.30~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0c48eecab70aea11cb32c4e6125ba6ce3a7e426;p=platform%2Fupstream%2Fnodejs.git Rename readPause and readResume to pause/resume --- diff --git a/doc/api.txt b/doc/api.txt index 08ac938a8..484374c33 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -1451,12 +1451,12 @@ this +readyState+ will be +"readOnly"+. Ensures that no more I/O activity happens on this socket. Only necessary in case of errors (parse error or so). -+connection.readPause()+:: ++connection.pause()+:: Pauses the reading of data. That is, +"data"+ events will not be emitted. Useful to throttle back an upload. -+connection.readResume()+:: -Resumes reading if reading was paused by +readPause()+. ++connection.resume()+:: +Resumes reading after a call to +pause()+. +connection.setTimeout(timeout)+:: Sets the connection to timeout after +timeout+ milliseconds of inactivity on diff --git a/src/node_net.cc b/src/node_net.cc index aaa4ddf6a..272862a8f 100644 --- a/src/node_net.cc +++ b/src/node_net.cc @@ -100,8 +100,8 @@ void Connection::Initialize(v8::Handle target) { NODE_SET_PROTOTYPE_METHOD(constructor_template, "close", Close); NODE_SET_PROTOTYPE_METHOD(constructor_template, "forceClose", ForceClose); NODE_SET_PROTOTYPE_METHOD(constructor_template, "setEncoding", SetEncoding); - NODE_SET_PROTOTYPE_METHOD(constructor_template, "readPause", ReadPause); - NODE_SET_PROTOTYPE_METHOD(constructor_template, "readResume", ReadResume); + NODE_SET_PROTOTYPE_METHOD(constructor_template, "pause", Pause); + NODE_SET_PROTOTYPE_METHOD(constructor_template, "resume", Resume); NODE_SET_PROTOTYPE_METHOD(constructor_template, "setTimeout", SetTimeout); NODE_SET_PROTOTYPE_METHOD(constructor_template, "setNoDelay", SetNoDelay); #if EVCOM_HAVE_GNUTLS @@ -513,24 +513,24 @@ Handle Connection::GetPeerCertificate(const Arguments& args) { } #endif -Handle Connection::ReadPause(const Arguments& args) { +Handle Connection::Pause(const Arguments& args) { HandleScope scope; Connection *connection = ObjectWrap::Unwrap(args.This()); assert(connection); - connection->ReadPause(); + connection->Pause(); return Undefined(); } -Handle Connection::ReadResume(const Arguments& args) { +Handle Connection::Resume(const Arguments& args) { HandleScope scope; Connection *connection = ObjectWrap::Unwrap(args.This()); assert(connection); - connection->ReadResume(); + connection->Resume(); return Undefined(); } diff --git a/src/node_net.h b/src/node_net.h index 35efe4160..12e9e1dbd 100644 --- a/src/node_net.h +++ b/src/node_net.h @@ -32,8 +32,8 @@ class Connection : public EventEmitter { static v8::Handle Close(const v8::Arguments& args); static v8::Handle ForceClose(const v8::Arguments& args); static v8::Handle SetEncoding(const v8::Arguments& args); - static v8::Handle ReadPause(const v8::Arguments& args); - static v8::Handle ReadResume(const v8::Arguments& args); + static v8::Handle Pause(const v8::Arguments& args); + static v8::Handle Resume(const v8::Arguments& args); static v8::Handle SetTimeout(const v8::Arguments& args); static v8::Handle SetNoDelay(const v8::Arguments& args); @@ -74,11 +74,11 @@ class Connection : public EventEmitter { evcom_stream_force_close(&stream_); } - void ReadPause() { + void Pause() { evcom_stream_read_pause(&stream_); } - void ReadResume() { + void Resume() { evcom_stream_read_resume(&stream_); } diff --git a/test/mjsunit/test-tcp-throttle-kernel-buffer.js b/test/mjsunit/test-tcp-throttle-kernel-buffer.js index 10fdcb4b7..a8fab1f5b 100644 --- a/test/mjsunit/test-tcp-throttle-kernel-buffer.js +++ b/test/mjsunit/test-tcp-throttle-kernel-buffer.js @@ -31,14 +31,14 @@ client.addListener("data", function (d) { chars_recved += d.length; puts("got " + chars_recved); if (!paused) { - client.readPause(); + client.pause(); npauses += 1; paused = true; puts("pause"); x = chars_recved; setTimeout(function () { assert.equal(chars_recved, x); - client.readResume(); + client.resume(); puts("resume"); paused = false; }, 100); diff --git a/test/mjsunit/test-tcp-throttle.js b/test/mjsunit/test-tcp-throttle.js index 239d7ccea..7e927d2d0 100644 --- a/test/mjsunit/test-tcp-throttle.js +++ b/test/mjsunit/test-tcp-throttle.js @@ -33,21 +33,21 @@ setTimeout(function () { chars_recved = recv.length; puts("pause at: " + chars_recved); assert.equal(true, chars_recved > 1); - client.readPause(); + client.pause(); setTimeout(function () { puts("resume at: " + chars_recved); assert.equal(chars_recved, recv.length); - client.readResume(); + client.resume(); setTimeout(function () { chars_recved = recv.length; puts("pause at: " + chars_recved); - client.readPause(); + client.pause(); setTimeout(function () { puts("resume at: " + chars_recved); assert.equal(chars_recved, recv.length); - client.readResume(); + client.resume(); }, 500);