Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sadzurami committed Feb 22, 2024
1 parent 778f0ec commit 2e64a1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/connection_protocols/tcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ class TCPConnection extends BaseConnection {
data = SteamCrypto.symmetricEncryptWithHmacIv(data, this.sessionKey);
}

if (!this.stream) {
this._debug('Tried to send message, but there is no stream');
return;
}

let buf = Buffer.alloc(4 + 4 + data.length);
buf.writeUInt32LE(data.length, 0);
buf.write(MAGIC, 4);
Expand Down Expand Up @@ -192,8 +197,12 @@ class TCPConnection extends BaseConnection {
}
}

let message;
if (!this.stream) {
this._debug('Tried to read message, but there is no stream');
return;
}

let message;
try {
message = this.stream.read(this._messageLength);
} catch (error) {
Expand Down

0 comments on commit 2e64a1a

Please sign in to comment.