net_uv: properly initialize writeQueueSize
authorRyan Dahl <ry@tinyclouds.org>
Tue, 19 Jul 2011 09:18:10 +0000 (02:18 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Tue, 19 Jul 2011 09:19:27 +0000 (02:19 -0700)
Fixes simple/test-tcp-wrap-listen.js

src/pipe_wrap.cc
src/stream_wrap.cc
src/stream_wrap.h
src/tcp_wrap.cc

index adbeb0f..5d0c512 100644 (file)
@@ -85,6 +85,7 @@ class PipeWrap : StreamWrap {
     int r = uv_pipe_init(&handle_);
     assert(r == 0); // How do we proxy this error up to javascript?
                     // Suggestion: uv_pipe_init() returns void.
+    UpdateWriteQueueSize();
   }
 
   static Handle<Value> Bind(const Arguments& args) {
index 3da51d9..528c523 100644 (file)
@@ -72,12 +72,11 @@ StreamWrap::StreamWrap(Handle<Object> object, uv_stream_t* stream)
     : HandleWrap(object, (uv_handle_t*)stream) {
   stream_ = stream;
   stream->data = this;
-
-  UpdateWriteQueueSize();
 }
 
 
 void StreamWrap::UpdateWriteQueueSize() {
+  HandleScope scope;
   object_->Set(write_queue_size_sym, Integer::New(stream_->write_queue_size));
 }
 
index d1b442f..f3e2c46 100644 (file)
@@ -21,9 +21,9 @@ class StreamWrap : public HandleWrap {
   StreamWrap(v8::Handle<v8::Object> object, uv_stream_t* stream);
   virtual ~StreamWrap() { }
   void StateChange() { }
+  void UpdateWriteQueueSize();
 
  private:
-  void UpdateWriteQueueSize();
   static inline char* NewSlab(v8::Handle<v8::Object> global, v8::Handle<v8::Object> wrap_obj);
 
   // Callbacks for libuv
index 814f7e2..51ff966 100644 (file)
@@ -111,6 +111,7 @@ class TCPWrap : public StreamWrap {
     int r = uv_tcp_init(&handle_);
     assert(r == 0); // How do we proxy this error up to javascript?
                     // Suggestion: uv_tcp_init() returns void.
+    UpdateWriteQueueSize();
   }
 
   ~TCPWrap() {