mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Rename readPause and readResume to pause/resume
This commit is contained in:
1 parent
1db824a9c1
commit
a0c48eecab
5 files changed
+19
-19
No files matched your search
+3
-3
@@ -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
|
||||
|
||||
+6
-6
@@ -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();
|
||||
}
|
||||
|
||||
+4
-4
@@ -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_);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user