Skip to content

Commit

Permalink
Move MAX_MESSAGE_SIZE assertion
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
  • Loading branch information
automated-signal and EvanHahn-Signal committed Sep 10, 2021
1 parent e374a76 commit 6722de0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ts/textsecure/WebsocketResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export default class WebSocketResource extends EventTarget {
id,
},
}).finish();
strictAssert(
bytes.length <= MAX_MESSAGE_SIZE,
'WebSocket request byte size exceeded'
);

strictAssert(!this.shuttingDown, 'Cannot send request, shutting down');
this.addActive(id);
Expand All @@ -210,10 +214,6 @@ export default class WebSocketResource extends EventTarget {
});
});

strictAssert(
bytes.length <= MAX_MESSAGE_SIZE,
'WebSocket request byte size exceeded'
);
this.socket.sendBytes(Buffer.from(bytes));

return promise;
Expand Down

0 comments on commit 6722de0

Please sign in to comment.