Rename readPause and readResume to pause/resume
authorRyan Dahl <ry@tinyclouds.org>
Sun, 21 Feb 2010 06:38:42 +0000 (22:38 -0800)
committerRyan Dahl <ry@tinyclouds.org>
Sun, 21 Feb 2010 06:38:42 +0000 (22:38 -0800)
doc/api.txt
src/node_net.cc
src/node_net.h
test/mjsunit/test-tcp-throttle-kernel-buffer.js
test/mjsunit/test-tcp-throttle.js

index 08ac938..484374c 100644 (file)
@@ -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
index aaa4ddf..272862a 100644 (file)
@@ -100,8 +100,8 @@ void Connection::Initialize(v8::Handle<v8::Object> 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<Value> Connection::GetPeerCertificate(const Arguments& args) {
 }
 #endif
 
-Handle<Value> Connection::ReadPause(const Arguments& args) {
+Handle<Value> Connection::Pause(const Arguments& args) {
   HandleScope scope;
 
   Connection *connection = ObjectWrap::Unwrap<Connection>(args.This());
   assert(connection);
 
-  connection->ReadPause();
+  connection->Pause();
 
   return Undefined();
 }
 
-Handle<Value> Connection::ReadResume(const Arguments& args) {
+Handle<Value> Connection::Resume(const Arguments& args) {
   HandleScope scope;
 
   Connection *connection = ObjectWrap::Unwrap<Connection>(args.This());
   assert(connection);
 
-  connection->ReadResume();
+  connection->Resume();
 
   return Undefined();
 }
index 35efe41..12e9e1d 100644 (file)
@@ -32,8 +32,8 @@ class Connection : public EventEmitter {
   static v8::Handle<v8::Value> Close(const v8::Arguments& args);
   static v8::Handle<v8::Value> ForceClose(const v8::Arguments& args);
   static v8::Handle<v8::Value> SetEncoding(const v8::Arguments& args);
-  static v8::Handle<v8::Value> ReadPause(const v8::Arguments& args);
-  static v8::Handle<v8::Value> ReadResume(const v8::Arguments& args);
+  static v8::Handle<v8::Value> Pause(const v8::Arguments& args);
+  static v8::Handle<v8::Value> Resume(const v8::Arguments& args);
   static v8::Handle<v8::Value> SetTimeout(const v8::Arguments& args);
   static v8::Handle<v8::Value> 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_);
   }
 
index 10fdcb4..a8fab1f 100644 (file)
@@ -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);
index 239d7cc..7e927d2 100644 (file)
@@ -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);