Fix server crashing when sending data on closing/closed socket

This commit is contained in:
Asher
2019-01-22 11:48:01 -06:00
committed by Kyle Carberry
parent 4e6d6f0725
commit 4eb9f87217
2 changed files with 12 additions and 7 deletions

View File

@ -117,11 +117,9 @@ export class Entry extends Command {
app.wss.on("connection", (ws, req) => {
const id = clientId++;
ws.on("open", () => {
if (sharedProcess.state === SharedProcessState.Ready) {
sendSharedProcessReady(ws);
}
});
if (sharedProcess.state === SharedProcessState.Ready) {
sendSharedProcessReady(ws);
}
logger.info(`WebSocket opened \u001B[0m${req.url}`, field("client", id), field("ip", req.socket.remoteAddress));