| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b30754a commit a597cb8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,7 +62,6 @@ MaybeLocal<Object> PipeWrap::Instantiate(Environment* env, | |||
| 62 | 62 | constructor->NewInstance(env->context(), 1, &type_value)); | |
| 63 | 63 | } | |
| 64 | 64 | ||
| 65 | - | ||
| 66 | 65 | void PipeWrap::Initialize(Local<Object> target, | |
| 67 | 66 | Local<Value> unused, | |
| 68 | 67 | Local<Context> context, | |
@@ -71,8 +70,7 @@ void PipeWrap::Initialize(Local<Object> target, | |||
| 71 | 70 | Isolate* isolate = env->isolate(); | |
| 72 | 71 | ||
| 73 | 72 | Local<FunctionTemplate> t = NewFunctionTemplate(isolate, New); | |
| 74 | - t->InstanceTemplate() | ||
| 75 | - ->SetInternalFieldCount(StreamBase::kInternalFieldCount); | ||
| 73 | + t->InstanceTemplate()->SetInternalFieldCount(StreamBase::kInternalFieldCount); | ||
| 76 | 74 | ||
| 77 | 75 | t->Inherit(LibuvStreamWrap::GetConstructorTemplate(env)); | |
| 78 | 76 | ||
@@ -102,9 +100,7 @@ void PipeWrap::Initialize(Local<Object> target, | |||
| 102 | 100 | NODE_DEFINE_CONSTANT(constants, IPC); | |
| 103 | 101 | NODE_DEFINE_CONSTANT(constants, UV_READABLE); | |
| 104 | 102 | NODE_DEFINE_CONSTANT(constants, UV_WRITABLE); | |
| 105 | - target->Set(context, | ||
| 106 | - env->constants_string(), | ||
| 107 | - constants).Check(); | ||
| 103 | + target->Set(context, env->constants_string(), constants).Check(); | ||
| 108 | 104 | } | |
| 109 | 105 | ||
| 110 | 106 | void PipeWrap::RegisterExternalReferences(ExternalReferenceRegistry* registry) { | |
@@ -152,7 +148,6 @@ void PipeWrap::New(const FunctionCallbackInfo<Value>& args) { | |||
| 152 | 148 | new PipeWrap(env, args.This(), provider, ipc); | |
| 153 | 149 | } | |
| 154 | 150 | ||
| 155 | - | ||
| 156 | 151 | PipeWrap::PipeWrap(Environment* env, | |
| 157 | 152 | Local<Object> object, | |
| 158 | 153 | ProviderType provider, | |
@@ -163,16 +158,14 @@ PipeWrap::PipeWrap(Environment* env, | |||
| 163 | 158 | // Suggestion: uv_pipe_init() returns void. | |
| 164 | 159 | } | |
| 165 | 160 | ||
| 166 | - | ||
| 167 | 161 | void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) { | |
| 168 | 162 | PipeWrap* wrap; | |
| 169 | 163 | ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | |
| 170 | 164 | node::Utf8Value name(args.GetIsolate(), args[0]); | |
| 171 | - int err = uv_pipe_bind(&wrap->handle_, *name); | ||
| 165 | + int err = uv_pipe_bind2(&wrap->handle_, *name, name.length(), 0); | ||
| 172 | 166 | args.GetReturnValue().Set(err); | |
| 173 | 167 | } | |
| 174 | 168 | ||
| 175 | - | ||
| 176 | 169 | #ifdef _WIN32 | |
| 177 | 170 | void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) { | |
| 178 | 171 | PipeWrap* wrap; | |
@@ -183,7 +176,6 @@ void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) { | |||
| 183 | 176 | } | |
| 184 | 177 | #endif | |
| 185 | 178 | ||
| 186 | - | ||
| 187 | 179 | void PipeWrap::Fchmod(const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 188 | 180 | PipeWrap* wrap; | |
| 189 | 181 | ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | |
@@ -193,20 +185,17 @@ void PipeWrap::Fchmod(const v8::FunctionCallbackInfo<v8::Value>& args) { | |||
| 193 | 185 | args.GetReturnValue().Set(err); | |
| 194 | 186 | } | |
| 195 | 187 | ||
| 196 | - | ||
| 197 | 188 | void PipeWrap::Listen(const FunctionCallbackInfo<Value>& args) { | |
| 198 | 189 | PipeWrap* wrap; | |
| 199 | 190 | ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | |
| 200 | 191 | Environment* env = wrap->env(); | |
| 201 | 192 | int backlog; | |
| 202 | 193 | if (!args[0]->Int32Value(env->context()).To(&backlog)) return; | |
| 203 | - int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_), | ||
| 204 | - backlog, | ||
| 205 | - OnConnection); | ||
| 194 | + int err = uv_listen( | ||
| 195 | + reinterpret_cast<uv_stream_t*>(&wrap->handle_), backlog, OnConnection); | ||
| 206 | 196 | args.GetReturnValue().Set(err); | |
| 207 | 197 | } | |
| 208 | 198 | ||
| 209 | - | ||
| 210 | 199 | void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) { | |
| 211 | 200 | Environment* env = Environment::GetCurrent(args); | |
| 212 | 201 | ||
@@ -222,7 +211,6 @@ void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) { | |||
| 222 | 211 | args.GetReturnValue().Set(err); | |
| 223 | 212 | } | |
| 224 | 213 | ||
| 225 | - | ||
| 226 | 214 | void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { | |
| 227 | 215 | Environment* env = Environment::GetCurrent(args); | |
| 228 | 216 | ||
@@ -237,10 +225,8 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { | |||
| 237 | 225 | ||
| 238 | 226 | ConnectWrap* req_wrap = | |
| 239 | 227 | new ConnectWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPECONNECTWRAP); | |
| 240 | - req_wrap->Dispatch(uv_pipe_connect, | ||
| 241 | - &wrap->handle_, | ||
| 242 | - *name, | ||
| 243 | - AfterConnect); | ||
| 228 | + req_wrap->Dispatch( | ||
| 229 | + uv_pipe_connect2, &wrap->handle_, *name, name.length(), 0, AfterConnect); | ||
| 244 | 230 | ||
| 245 | 231 | TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native), | |
| 246 | 232 | "connect", | |
@@ -251,7 +237,6 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { | |||
| 251 | 237 | args.GetReturnValue().Set(0); // uv_pipe_connect() doesn't return errors. | |
| 252 | 238 | } | |
| 253 | 239 | ||
| 254 | - | ||
| 255 | 240 | } // namespace node | |
| 256 | 241 | ||
| 257 | 242 | NODE_BINDING_CONTEXT_AWARE_INTERNAL(pipe_wrap, node::PipeWrap::Initialize) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,27 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const http = require('http'); | ||
| 5 | + | ||
| 6 | + if (!common.isLinux) common.skip(); | ||
| 7 | + | ||
| 8 | + const server = http.createServer( | ||
| 9 | + common.mustCall((req, res) => { | ||
| 10 | + res.end('ok'); | ||
| 11 | + }) | ||
| 12 | + ); | ||
| 13 | + | ||
| 14 | + server.listen( | ||
| 15 | + '\0abstract', | ||
| 16 | + common.mustCall(() => { | ||
| 17 | + http.get( | ||
| 18 | + { | ||
| 19 | + socketPath: server.address(), | ||
| 20 | + }, | ||
| 21 | + common.mustCall((res) => { | ||
| 22 | + assert.strictEqual(res.statusCode, 200); | ||
| 23 | + server.close(); | ||
| 24 | + }) | ||
| 25 | + ); | ||
| 26 | + }) | ||
| 27 | + ); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments