Skip to content

Commit

Permalink
fix(core-p2p): properly terminate bad connections (#3103)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodf authored and spkjp committed Nov 21, 2019
1 parent 97782d8 commit 6f7b54c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core-p2p/src/socket-server/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Worker extends SCWorker {
if (message === "#2") {
const timeNow: number = new Date().getTime() / 1000;
if (ws._lastPingTime && timeNow - ws._lastPingTime < 1) {
req.socket.terminate();
ws.terminate();
}
ws._lastPingTime = timeNow;
} else {
Expand All @@ -41,7 +41,7 @@ export class Worker extends SCWorker {
parsed.event === "#disconnect" &&
typeof parsed.cid !== "undefined")
) {
req.socket.terminate();
ws.terminate();
}
}
} catch (error) {
Expand Down

0 comments on commit 6f7b54c

Please sign in to comment.