Safely send disconnected peers
This commit is contained in:
parent
eeee824b20
commit
912f32e7ab
|
@ -2,7 +2,7 @@ const { Client } = require("../Client.js");
|
|||
let {addService, addListener} = require("../WebSocket.js");
|
||||
|
||||
addListener('disconnect',(global, xclient)=>{
|
||||
const {intersection} = xclient.getSucureClients();
|
||||
const {intersection, pairs} = xclient.getSucureClients();
|
||||
for (const [clientid, client] of intersection)
|
||||
{
|
||||
client.send([
|
||||
|
@ -12,6 +12,12 @@ addListener('disconnect',(global, xclient)=>{
|
|||
"peer/disconnect"
|
||||
])
|
||||
}
|
||||
|
||||
for (const [id, peer] of pairs)
|
||||
{
|
||||
peer.pairs.delete(xclient.id);
|
||||
xclient.pairs.delete(id);
|
||||
}
|
||||
});
|
||||
|
||||
addService(({
|
||||
|
|
Loading…
Reference in New Issue