*Move existing connection logic up

This commit is contained in:
Derrick Hammer 2023-04-04 11:22:37 -04:00
parent c0b99e8146
commit 2f30b743f6
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 6 deletions

View File

@ -351,6 +351,12 @@ async function handleListenConnections(aq: ActiveQuery) {
aq.respond();
});
for (const conn of connections) {
if (conn[1].swarm === swarmId) {
listener(conn[1].conn);
}
}
const closeCb = () => {
swarmEvent?.off("connection", listener);
swarmEvent?.emit("close");
@ -366,12 +372,6 @@ async function handleListenConnections(aq: ActiveQuery) {
return;
}
swarm.onceSelf("ready", hookClose);
for (const conn of connections) {
if (conn[1].swarm === swarmId) {
listener(conn[1].conn);
}
}
}
async function handleGetSocketInfo(aq: ActiveQuery) {