Permalink
Browse files

binding for uv_pipe_pending_instances

  • Loading branch information...
1 parent dd4b280 commit 99c9d19184fdd46ae88464d7a608aac57a530634 Igor Zinkovsky committed Dec 1, 2011
Showing with 36 additions and 2 deletions.
  1. +13 −2 lib/net.js
  2. +19 −0 src/pipe_wrap.cc
  3. +4 −0 src/pipe_wrap.h
View
@@ -657,8 +657,19 @@ var createServerHandle = exports._createServerHandle =
function(address, port, addressType) {
var r = 0;
// assign handle in listen, and clean up if bind or listen fails
- var handle =
- (port == -1 && addressType == -1) ? createPipe() : createTCP();
+ var handle;
+
+ if (port == -1 && addressType == -1) {
+ handle = createPipe();
+ if (process.platform === 'win32') {
+ var instances = parseInt(process.env.NODE_PENDING_PIPE_INSTANCES);
+ if (!isNaN(instances)) {
+ handle.setPendingInstances(instances);
+ }
+ }
+ } else {
+ handle = createTCP();
+ }
if (address || port) {
debug('bind to ' + address);
View
@@ -96,6 +96,10 @@ void PipeWrap::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "connect", Connect);
NODE_SET_PROTOTYPE_METHOD(t, "open", Open);
+#ifdef _WIN32
+ NODE_SET_PROTOTYPE_METHOD(t, "setPendingInstances", SetPendingInstances);
+#endif
+
pipeConstructor = Persistent<Function>::New(t->GetFunction());
target->Set(String::NewSymbol("Pipe"), pipeConstructor);
@@ -142,6 +146,21 @@ Handle<Value> PipeWrap::Bind(const Arguments& args) {
}
+#ifdef _WIN32
+Handle<Value> PipeWrap::SetPendingInstances(const Arguments& args) {
+ HandleScope scope;
+
+ UNWRAP
+
+ int instances = args[0]->Int32Value();
+
+ uv_pipe_pending_instances(&wrap->handle_, instances);
+
+ return v8::Null();
+}
+#endif
+
+
Handle<Value> PipeWrap::Listen(const Arguments& args) {
HandleScope scope;
View
@@ -41,6 +41,10 @@ class PipeWrap : StreamWrap {
static v8::Handle<v8::Value> Connect(const v8::Arguments& args);
static v8::Handle<v8::Value> Open(const v8::Arguments& args);
+#ifdef _WIN32
+ static v8::Handle<v8::Value> SetPendingInstances(const v8::Arguments& args);
+#endif
+
static void OnConnection(uv_stream_t* handle, int status);
static void AfterConnect(uv_connect_t* req, int status);

0 comments on commit 99c9d19

Please sign in to comment.