-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: add diagnostics channel and perf hooks detail
Co-Authored-By: theanarkh <[email protected]> PR-URL: #43984 Backport-PR-URL: #44256 Reviewed-By: Matteo Collina [email protected] Reviewed-By: Mohammed Keyvanzadeh [email protected] Reviewed-By: Minwoo Jung [email protected]
- Loading branch information
Showing
10 changed files
with
136 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const net = require('net'); | ||
const dc = require('diagnostics_channel'); | ||
|
||
const netClientSocketChannel = dc.channel('net.client.socket'); | ||
const netServerSocketChannel = dc.channel('net.server.socket'); | ||
|
||
const isNetSocket = (socket) => socket instanceof net.Socket; | ||
|
||
netClientSocketChannel.subscribe(common.mustCall(({ socket }) => { | ||
assert.strictEqual(isNetSocket(socket), true); | ||
})); | ||
|
||
netServerSocketChannel.subscribe(common.mustCall(({ socket }) => { | ||
assert.strictEqual(isNetSocket(socket), true); | ||
})); | ||
|
||
const server = net.createServer(common.mustCall((socket) => { | ||
socket.destroy(); | ||
server.close(); | ||
})); | ||
|
||
server.listen(() => { | ||
const { port } = server.address(); | ||
net.connect(port); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const dgram = require('dgram'); | ||
const dc = require('diagnostics_channel'); | ||
|
||
const udpSocketChannel = dc.channel('udp.socket'); | ||
|
||
const isUDPSocket = (socket) => socket instanceof dgram.Socket; | ||
|
||
udpSocketChannel.subscribe(common.mustCall(({ socket }) => { | ||
assert.strictEqual(isUDPSocket(socket), true); | ||
})); | ||
const socket = dgram.createSocket('udp4'); | ||
socket.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters