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

Method onData

deps/undici/src/lib/core/socks5-client.js:98–117  ·  view source on GitHub ↗

* Handle incoming data from the socket

(data)

Source from the content-addressed store, hash-verified

96 * Handle incoming data from the socket
97 */
98 onData (data) {
99 debug('received data', data.length, 'bytes in state', this.state)
100 this.buffer = Buffer.concat([this.buffer, data])
101
102 try {
103 switch (this.state) {
104 case STATES.HANDSHAKING:
105 this.handleHandshakeResponse()
106 break
107 case STATES.AUTHENTICATING:
108 this.handleAuthResponse()
109 break
110 case STATES.CONNECTING:
111 this.handleConnectResponse()
112 break
113 }
114 } catch (err) {
115 this.onError(err)
116 }
117 }
118
119 /**
120 * Handle socket errors

Callers 1

onResponseDataMethod · 0.45

Calls 6

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

Tested by

no test coverage detected