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
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
}
#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();
}
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);
evcom_stream_force_close(&stream_);
}
- void ReadPause() {
+ void Pause() {
evcom_stream_read_pause(&stream_);
}
- void ReadResume() {
+ void Resume() {
evcom_stream_read_resume(&stream_);
}
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);
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);