File tree 3 files changed +36
-2
lines changed
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 =
657
657
function ( address , port , addressType ) {
658
658
var r = 0 ;
659
659
// 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
+ }
662
673
663
674
if ( address || port ) {
664
675
debug ( 'bind to ' + address ) ;
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ void PipeWrap::Initialize(Handle<Object> target) {
96
96
NODE_SET_PROTOTYPE_METHOD (t, " connect" , Connect);
97
97
NODE_SET_PROTOTYPE_METHOD (t, " open" , Open);
98
98
99
+ #ifdef _WIN32
100
+ NODE_SET_PROTOTYPE_METHOD (t, " setPendingInstances" , SetPendingInstances);
101
+ #endif
102
+
99
103
pipeConstructor = Persistent<Function>::New (t->GetFunction ());
100
104
101
105
target->Set (String::NewSymbol (" Pipe" ), pipeConstructor);
@@ -142,6 +146,21 @@ Handle<Value> PipeWrap::Bind(const Arguments& args) {
142
146
}
143
147
144
148
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
+
145
164
Handle <Value> PipeWrap::Listen (const Arguments& args) {
146
165
HandleScope scope;
147
166
Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ class PipeWrap : StreamWrap {
41
41
static v8::Handle <v8::Value> Connect (const v8::Arguments& args);
42
42
static v8::Handle <v8::Value> Open (const v8::Arguments& args);
43
43
44
+ #ifdef _WIN32
45
+ static v8::Handle <v8::Value> SetPendingInstances (const v8::Arguments& args);
46
+ #endif
47
+
44
48
static void OnConnection (uv_stream_t * handle, int status);
45
49
static void AfterConnect (uv_connect_t * req, int status);
46
50
You can’t perform that action at this time.
0 commit comments