Immediately pause web socket

This will buffer any data sent to it until something is ready to listen
on it.
This commit is contained in:
Asher 2020-10-30 13:38:13 -05:00
parent 0b9af6ef67
commit 07e7c38ea2
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -738,6 +738,8 @@ export class HttpServer {
} }
private onUpgrade = async (request: http.IncomingMessage, socket: net.Socket, head: Buffer): Promise<void> => { private onUpgrade = async (request: http.IncomingMessage, socket: net.Socket, head: Buffer): Promise<void> => {
socket.pause()
try { try {
this.heart.beat() this.heart.beat()
socket.on("error", () => socket.destroy()) socket.on("error", () => socket.destroy())