|
|
@ -238,7 +238,8 @@ class Request { |
|
|
|
reply (value, opts = {}) { |
|
|
|
const socket = opts.socket || this.socket |
|
|
|
const to = opts.to || this.from |
|
|
|
this._sendReply(0, value || null, opts.token !== false, opts.closerNodes !== false, to, socket) |
|
|
|
const onflush = opts.onflush || null |
|
|
|
this._sendReply(0, value || null, opts.token !== false, opts.closerNodes !== false, to, socket, onflush) |
|
|
|
} |
|
|
|
|
|
|
|
error (code, opts = {}) { |
|
|
@ -268,7 +269,7 @@ class Request { |
|
|
|
} |
|
|
|
|
|
|
|
sendReply (error, value, token, hasCloserNodes) { |
|
|
|
this._sendReply(error, value, token, hasCloserNodes, this.from, this.socket) |
|
|
|
this._sendReply(error, value, token, hasCloserNodes, this.from, this.socket, null) |
|
|
|
} |
|
|
|
|
|
|
|
_sendNow () { |
|
|
@ -293,7 +294,7 @@ class Request { |
|
|
|
this.onerror(err || DESTROY, this) |
|
|
|
} |
|
|
|
|
|
|
|
_sendReply (error, value, token, hasCloserNodes, from, socket) { |
|
|
|
_sendReply (error, value, token, hasCloserNodes, from, socket, onflush) { |
|
|
|
if (socket === null || this.destroyed) return |
|
|
|
|
|
|
|
const id = this._io.ephemeral === false && socket === this._io.serverSocket |
|
|
@ -319,7 +320,7 @@ class Request { |
|
|
|
if (error > 0) c.uint.encode(state, error) |
|
|
|
if (value) c.buffer.encode(state, value) |
|
|
|
|
|
|
|
socket.send(state.buffer, 0, state.buffer.byteLength, from.port, from.host) |
|
|
|
socket.send(state.buffer, 0, state.buffer.byteLength, from.port, from.host, onflush) |
|
|
|
} |
|
|
|
|
|
|
|
_encodeRequest (token, value, socket) { |
|
|
|