MCPcopy Index your code
hub / github.com/nodejs/node / _request

Method _request

lib/internal/socket_list.js:16–37  ·  view source on GitHub ↗
(msg, cmd, swallowErrors, callback)

Source from the content-addressed store, hash-verified

14 }
15
16 _request(msg, cmd, swallowErrors, callback) {
17 const self = this;
18
19 if (!this.child.connected) return onclose();
20 this.child._send(msg, undefined, swallowErrors);
21
22 function onclose() {
23 self.child.removeListener('internalMessage', onreply);
24 callback(new ERR_CHILD_CLOSED_BEFORE_REPLY());
25 }
26
27 function onreply(msg) {
28 if (!(msg.cmd === cmd && msg.key === self.key)) return;
29 self.child.removeListener('disconnect', onclose);
30 self.child.removeListener('internalMessage', onreply);
31
32 callback(null, msg);
33 }
34
35 this.child.once('disconnect', onclose);
36 this.child.on('internalMessage', onreply);
37 }
38
39 close(callback) {
40 this._request({

Callers 3

closeMethod · 0.95
getConnectionsMethod · 0.95

Calls 4

_sendMethod · 0.80
oncloseFunction · 0.50
onceMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected