File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed
Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -657,8 +657,19 @@ var createServerHandle = exports._createServerHandle =
657657 function ( address , port , addressType ) {
658658 var r = 0 ;
659659 // assign handle in listen, and clean up if bind or listen fails
660- var handle =
661- ( port == - 1 && addressType == - 1 ) ? createPipe ( ) : createTCP ( ) ;
660+ var handle ;
661+
662+ if ( port == - 1 && addressType == - 1 ) {
663+ handle = createPipe ( ) ;
664+ if ( process . platform === 'win32' ) {
665+ var instances = parseInt ( process . env . NODE_PENDING_PIPE_INSTANCES ) ;
666+ if ( ! isNaN ( instances ) ) {
667+ handle . setPendingInstances ( instances ) ;
668+ }
669+ }
670+ } else {
671+ handle = createTCP ( ) ;
672+ }
662673
663674 if ( address || port ) {
664675 debug ( 'bind to ' + address ) ;
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ void PipeWrap::Initialize(Handle<Object> target) {
9696 NODE_SET_PROTOTYPE_METHOD (t, " connect" , Connect);
9797 NODE_SET_PROTOTYPE_METHOD (t, " open" , Open);
9898
99+ #ifdef _WIN32
100+ NODE_SET_PROTOTYPE_METHOD (t, " setPendingInstances" , SetPendingInstances);
101+ #endif
102+
99103 pipeConstructor = Persistent<Function>::New (t->GetFunction ());
100104
101105 target->Set (String::NewSymbol (" Pipe" ), pipeConstructor);
@@ -142,6 +146,21 @@ Handle<Value> PipeWrap::Bind(const Arguments& args) {
142146}
143147
144148
149+ #ifdef _WIN32
150+ Handle<Value> PipeWrap::SetPendingInstances (const Arguments& args) {
151+ HandleScope scope;
152+
153+ UNWRAP
154+
155+ int instances = args[0 ]->Int32Value ();
156+
157+ uv_pipe_pending_instances (&wrap->handle_ , instances);
158+
159+ return v8::Null ();
160+ }
161+ #endif
162+
163+
145164Handle<Value> PipeWrap::Listen (const Arguments& args) {
146165 HandleScope scope;
147166
Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ class PipeWrap : StreamWrap {
4141 static v8::Handle<v8::Value> Connect (const v8::Arguments& args);
4242 static v8::Handle<v8::Value> Open (const v8::Arguments& args);
4343
44+ #ifdef _WIN32
45+ static v8::Handle<v8::Value> SetPendingInstances (const v8::Arguments& args);
46+ #endif
47+
4448 static void OnConnection (uv_stream_t * handle, int status);
4549 static void AfterConnect (uv_connect_t * req, int status);
4650
You can’t perform that action at this time.
0 commit comments