Browse Source

binding for uv_pipe_pending_instances

v0.7.4-release
Igor Zinkovsky 13 years ago
parent
commit
99c9d19184
  1. 15
      lib/net.js
  2. 19
      src/pipe_wrap.cc
  3. 4
      src/pipe_wrap.h

15
lib/net.js

@ -657,8 +657,19 @@ var createServerHandle = exports._createServerHandle =
function(address, port, addressType) { function(address, port, addressType) {
var r = 0; var r = 0;
// assign handle in listen, and clean up if bind or listen fails // assign handle in listen, and clean up if bind or listen fails
var handle = var handle;
(port == -1 && addressType == -1) ? createPipe() : createTCP();
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) { if (address || port) {
debug('bind to ' + address); debug('bind to ' + address);

19
src/pipe_wrap.cc

@ -96,6 +96,10 @@ void PipeWrap::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "connect", Connect); NODE_SET_PROTOTYPE_METHOD(t, "connect", Connect);
NODE_SET_PROTOTYPE_METHOD(t, "open", Open); NODE_SET_PROTOTYPE_METHOD(t, "open", Open);
#ifdef _WIN32
NODE_SET_PROTOTYPE_METHOD(t, "setPendingInstances", SetPendingInstances);
#endif
pipeConstructor = Persistent<Function>::New(t->GetFunction()); pipeConstructor = Persistent<Function>::New(t->GetFunction());
target->Set(String::NewSymbol("Pipe"), pipeConstructor); 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) { Handle<Value> PipeWrap::Listen(const Arguments& args) {
HandleScope scope; HandleScope scope;

4
src/pipe_wrap.h

@ -41,6 +41,10 @@ class PipeWrap : StreamWrap {
static v8::Handle<v8::Value> Connect(const v8::Arguments& args); static v8::Handle<v8::Value> Connect(const v8::Arguments& args);
static v8::Handle<v8::Value> Open(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 OnConnection(uv_stream_t* handle, int status);
static void AfterConnect(uv_connect_t* req, int status); static void AfterConnect(uv_connect_t* req, int status);

Loading…
Cancel
Save