diff --git a/lib/server.js b/lib/server.js index 5b0645a3..d23e486b 100644 --- a/lib/server.js +++ b/lib/server.js @@ -307,7 +307,7 @@ module.exports = class Server extends EventEmitter { if (hs.rawStream.connected) { hs.rawStream.once('remote-changed', () => { - hs.encryptedSocket.relay.unrelay() + if (hs.encryptedSocket) hs.encryptedSocket.relay.unrelay() }) const remoteChanging = hs.rawStream.changeRemote(socket, remotePayload.udx.id, port, host) @@ -666,7 +666,7 @@ module.exports = class Server extends EventEmitter { const socket = hs.relaySocket hs.relayToken = null hs.relaySocket = null - hs.encryptedSocket.relay.close() + if (hs.encryptedSocket) hs.encryptedSocket.relay.close() if (socket) socket.destroy() } }