aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-06-16 15:49:44 +0200
committerRyan Dahl <ry@tinyclouds.org>2011-06-16 15:49:44 +0200
commit97296e405c90b482f5a4bebfdb7a4fd30379585f (patch)
tree4fa3fe5c802d8947c3bca11dcc18a3fcceeb0337 /src
parentddc989333dced1fd33baf1114fccd15a333771e3 (diff)
downloadandroid-node-v8-97296e405c90b482f5a4bebfdb7a4fd30379585f.tar.gz
android-node-v8-97296e405c90b482f5a4bebfdb7a4fd30379585f.tar.bz2
android-node-v8-97296e405c90b482f5a4bebfdb7a4fd30379585f.zip
tcp_wrap: add writeQueueSize
Diffstat (limited to 'src')
-rw-r--r--src/tcp_wrap.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index 6f7ac5b81a..4dcda455de 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -59,6 +59,7 @@ static uv_tcp_t* handle_that_last_alloced;
static Persistent<String> slab_sym;
static Persistent<String> buffer_sym;
+static Persistent<String> write_queue_size_sym;
class TCPWrap;
@@ -104,6 +105,8 @@ class TCPWrap {
slab_sym = Persistent<String>::New(String::NewSymbol("slab"));
buffer_sym = Persistent<String>::New(String::NewSymbol("buffer"));
+ write_queue_size_sym =
+ Persistent<String>::New(String::NewSymbol("writeQueueSize"));
target->Set(String::NewSymbol("TCP"), constructor);
}
@@ -131,6 +134,8 @@ class TCPWrap {
assert(object->InternalFieldCount() > 0);
object_ = v8::Persistent<v8::Object>::New(object);
object_->SetPointerInInternalField(0, this);
+
+ UpdateWriteQueueSize();
}
~TCPWrap() {
@@ -143,6 +148,10 @@ class TCPWrap {
delete wrap;
}
+ inline void UpdateWriteQueueSize() {
+ object_->Set(write_queue_size_sym, Integer::New(handle_.write_queue_size));
+ }
+
static Handle<Value> Bind(const Arguments& args) {
HandleScope scope;
@@ -347,6 +356,8 @@ class TCPWrap {
SetErrno(uv_last_error().code);
}
+ wrap->UpdateWriteQueueSize();
+
Local<Value> argv[4] = {
Integer::New(status),
Local<Value>::New(wrap->object_),
@@ -396,6 +407,8 @@ class TCPWrap {
// Error starting the TCP.
if (r) SetErrno(uv_last_error().code);
+ wrap->UpdateWriteQueueSize();
+
return scope.Close(req_wrap->object_);
}