MCPcopy Create free account
hub / github.com/nodejs/node / onData

Method onData

deps/undici/undici.js:10637–10655  ·  view source on GitHub ↗

* Handle incoming data from the socket

(data)

Source from the content-addressed store, hash-verified

10635 * Handle incoming data from the socket
10636 */
10637 onData(data) {
10638 debug("received data", data.length, "bytes in state", this.state);
10639 this.buffer = Buffer2.concat([this.buffer, data]);
10640 try {
10641 switch (this.state) {
10642 case STATES.HANDSHAKING:
10643 this.handleHandshakeResponse();
10644 break;
10645 case STATES.AUTHENTICATING:
10646 this.handleAuthResponse();
10647 break;
10648 case STATES.CONNECTING:
10649 this.handleConnectResponse();
10650 break;
10651 }
10652 } catch (err) {
10653 this.onError(err);
10654 }
10655 }
10656 /**
10657 * Handle socket errors
10658 */

Callers 2

onResponseDataMethod · 0.45

Calls 6

concatMethod · 0.80
debugFunction · 0.50
handleAuthResponseMethod · 0.45
handleConnectResponseMethod · 0.45
onErrorMethod · 0.45

Tested by

no test coverage detected