Compare commits

..

No commits in common. "66dc7cdac2e185a8e9aec104e4dbf1f90b59e4db" and "37ce0ff5bf53eb14ef039fc86071e9b18ccebdbd" have entirely different histories.

View File

@ -19,18 +19,20 @@ class Client extends EventEmitter {
this.destroy();
});
process.on('SIGTERM', async () => {
process.on('SIGTERM', () => {
console.log('SIGTERM signal received. Shutting down HyperSwarm...');
await this.destroy()
console.log('HyperSwarm was shut down. Exiting the process with exit code 0.');
process.exit(0);
this.destroy().then(() => {
console.log('HyperSwarm was shut down. Exiting the process with exit code 0.');
process.exit(0);
});
});
process.on('SIGINT', async () => {
process.on('SIGINT', () => {
console.log('SIGINT signal received. Shutting down HyperSwarm...');
await this.destroy()
console.log('HyperSwarm was shut down. Exiting the process with exit code 0.');
process.exit(0);
this.destroy().then(() => {
console.log('HyperSwarm was shut down. Exiting the process with exit code 0.');
process.exit(0);
});
});
}
@ -87,8 +89,8 @@ class Client extends EventEmitter {
for (const peer of peers) peer.write(data);
}
async destroy() {
await this.swarm.destroy();
destroy() {
this.swarm.destroy();
console.log(`Bot ${this.botName} disconnected.`);
}
}