-
Notifications
You must be signed in to change notification settings - Fork 30k
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
PR-URL: #43984 Reviewed-By: Matteo Collina matteo.collina@gmail.com Reviewed-By: Mohammed Keyvanzadeh mohammadkeyvanzade94@gmail.com Reviewed-By: Minwoo Jung nodecorelab@gmail.com
- Loading branch information
1 parent
e028edb
commit 62e2bbd
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