Compare commits

...

2 Commits

Author SHA1 Message Date
Derrick Hammer 54a817742c
*Update dist 2023-02-17 08:20:16 -05:00
Derrick Hammer a7384cf688
*Listen for connections before waiting for ready 2023-02-17 08:20:02 -05:00
2 changed files with 6 additions and 6 deletions

4
dist/index.js vendored
View File

@ -39,11 +39,11 @@ export class SwarmClient extends Client {
if (this._ready) { if (this._ready) {
return this._ready; return this._ready;
} }
this._ready = this.callModuleReturn("ready", { swarm: this.swarm });
await this._ready;
this.connectModule("listenConnections", { swarm: this.swarm }, async (socketId) => { this.connectModule("listenConnections", { swarm: this.swarm }, async (socketId) => {
this.emit("connection", await createSocket(socketId)); this.emit("connection", await createSocket(socketId));
}); });
this._ready = this.callModuleReturn("ready", { swarm: this.swarm });
await this._ready;
this._ready = undefined; this._ready = undefined;
} }
async start() { async start() {

View File

@ -53,10 +53,6 @@ export class SwarmClient extends Client {
return this._ready; return this._ready;
} }
this._ready = this.callModuleReturn("ready", { swarm: this.swarm });
await this._ready;
this.connectModule( this.connectModule(
"listenConnections", "listenConnections",
{ swarm: this.swarm }, { swarm: this.swarm },
@ -65,6 +61,10 @@ export class SwarmClient extends Client {
} }
); );
this._ready = this.callModuleReturn("ready", { swarm: this.swarm });
await this._ready;
this._ready = undefined; this._ready = undefined;
} }