From afc9b5a5426d6729750491c218109b44fd54931c Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 16 Sep 2021 13:19:22 +0200 Subject: [PATCH] fix wrong to stamp in message --- lib/io.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/io.js b/lib/io.js index 816c003..25a26dd 100644 --- a/lib/io.js +++ b/lib/io.js @@ -250,7 +250,7 @@ class Request { relay (value, to, opts) { const socket = (opts && opts.socket) || this.socket - const buffer = this._encodeRequest(null, value, socket) + const buffer = this._encodeRequest(null, value, to, socket) socket.send(buffer, 0, buffer.byteLength, to.port, to.host) } @@ -258,7 +258,7 @@ class Request { if (this.destroyed) return if (this.socket === null) return - if (this._buffer === null) this._buffer = this._encodeRequest(this.token, this.value, this.socket) + if (this._buffer === null) this._buffer = this._encodeRequest(this.token, this.value, this.to, this.socket) if (!force && this._io.congestion.isFull()) { this._io._pending.push(this) @@ -323,7 +323,7 @@ class Request { socket.send(state.buffer, 0, state.buffer.byteLength, from.port, from.host, onflush) } - _encodeRequest (token, value, socket) { + _encodeRequest (token, value, to, socket) { const id = this._io.ephemeral === false && socket === this._io.serverSocket const state = { start: 0, end: 1 + 1 + 6 + 2, buffer: null } // (type | version) + flags + to + tid @@ -340,7 +340,7 @@ class Request { state.buffer[state.start++] = (id ? 1 : 0) | (token ? 2 : 0) | (this.target ? 4 : 0) | (value ? 8 : 0) c.uint16.encode(state, this.tid) - peer.ipv4.encode(state, this.to) + peer.ipv4.encode(state, to) if (id) c.fixed32.encode(state, this._io.table.id) if (token) c.fixed32.encode(state, token)