| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -230,11 +230,15 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { | |||
| 230 | 230 | if (err) { | |
| 231 | 231 | delete req_wrap; | |
| 232 | 232 | } else { | |
| 233 | - TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native), | ||
| 233 | + const char* path_type = (*name)[0] == '\0' ? "abstract socket" : "file"; | ||
| 234 | + const char* pipe_path = (*name)[0] == '\0' ? (*name) + 1 : *name; | ||
| 235 | + TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(TRACING_CATEGORY_NODE2(net, native), | ||
| 234 | 236 | "connect", | |
| 235 | 237 | req_wrap, | |
| 238 | + "path_type", | ||
| 239 | + path_type, | ||
| 236 | 240 | "pipe_path", | |
| 237 | - TRACE_STR_COPY(*name)); | ||
| 241 | + TRACE_STR_COPY(pipe_path)); | ||
| 238 | 242 | } | |
| 239 | 243 | ||
| 240 | 244 | args.GetReturnValue().Set(err); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,43 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const cp = require('child_process'); | ||
| 5 | + const fs = require('fs'); | ||
| 6 | + const tmpdir = require('../common/tmpdir'); | ||
| 7 | + | ||
| 8 | + if (!common.isLinux) common.skip(); | ||
| 9 | + | ||
| 10 | + const CODE = ` | ||
| 11 | + const net = require('net'); | ||
| 12 | + net.connect('${common.PIPE}').on('error', () => {}); | ||
| 13 | + net.connect('\\0${common.PIPE}').on('error', () => {}); | ||
| 14 | + `; | ||
| 15 | + | ||
| 16 | + tmpdir.refresh(); | ||
| 17 | + const FILE_NAME = tmpdir.resolve('node_trace.1.log'); | ||
| 18 | + | ||
| 19 | + const proc = cp.spawn(process.execPath, | ||
| 20 | + [ '--trace-events-enabled', | ||
| 21 | + '--trace-event-categories', 'node.net.native', | ||
| 22 | + '-e', CODE ], | ||
| 23 | + { cwd: tmpdir.path }); | ||
| 24 | + | ||
| 25 | + proc.once('exit', common.mustCall(() => { | ||
| 26 | + assert(fs.existsSync(FILE_NAME)); | ||
| 27 | + fs.readFile(FILE_NAME, common.mustCall((err, data) => { | ||
| 28 | + const traces = JSON.parse(data.toString()).traceEvents; | ||
| 29 | + assert(traces.length > 0); | ||
| 30 | + let count = 0; | ||
| 31 | + traces.forEach((trace) => { | ||
| 32 | + if (trace.cat === 'node,node.net,node.net.native' && | ||
| 33 | + trace.name === 'connect') { | ||
| 34 | + count++; | ||
| 35 | + if (trace.ph === 'b') { | ||
| 36 | + assert.ok(!!trace.args.path_type); | ||
| 37 | + assert.ok(!!trace.args.pipe_path); | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + }); | ||
| 41 | + assert.strictEqual(count, 4); | ||
| 42 | + })); | ||
| 43 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments