Commit 9df46a5b authored by nanahira's avatar nanahira

fix error stuck

parent 6676b083
......@@ -135,6 +135,12 @@ export class Attacker {
return null;
}
async close() {
return new Promise<void>((done) => {
this.socket.close(done);
});
}
async attack(): Promise<string> {
this.socket = dgram.createSocket('udp4');
let err: string = null;
......@@ -157,6 +163,7 @@ export class Attacker {
});
for (const step of AttackRoutine) {
if (this.error) {
await this.close();
return `Error: ${this.error.toString()}`;
}
err = await this.performStep(step);
......@@ -164,9 +171,7 @@ export class Attacker {
break;
}
}
await new Promise<void>((done) => {
this.socket.close(done);
});
await this.close();
return err;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment