Skip to content

Commit 47f342c

Browse files
Fix server not correctly removing clients (#588)
* Properly remove connection from clients list * Changed misname in onCloseConnection * Update server.js fix --------- Co-authored-by: JSbETms <[email protected]> Co-authored-by: extremeheat <[email protected]>
1 parent 328785d commit 47f342c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/server.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ class Server extends EventEmitter {
8989
this.emit('connect', player)
9090
}
9191

92-
onCloseConnection = (inetAddr, reason) => {
93-
this.conLog('Connection closed: ', inetAddr?.address, reason)
94-
95-
delete this.clients[inetAddr]?.connection // Prevent close loop
96-
this.clients[inetAddr?.address ?? inetAddr]?.close()
97-
delete this.clients[inetAddr]
92+
onCloseConnection = (conn, reason) => {
93+
this.conLog('Connection closed: ', conn.address, reason)
94+
this.clients[conn.address]?.close()
95+
delete this.clients[conn.address]
9896
this.clientCount--
9997
}
10098

0 commit comments

Comments
 (0)