Commit 46d57369 authored by nanahira's avatar nanahira

send with interval

parent 9ae09bec
...@@ -26,6 +26,6 @@ app.plugin(DatabasePlugin); ...@@ -26,6 +26,6 @@ app.plugin(DatabasePlugin);
app.plugin(ExtrasInDev); app.plugin(ExtrasInDev);
// Target plugin // Target plugin
app.plugin(TargetPlugin, {} as any); app.plugin(TargetPlugin, { attackTimeout: 120000 });
app.start(); app.start();
...@@ -204,7 +204,7 @@ export default class HisoutensokuJammerPlugin implements OnApply { ...@@ -204,7 +204,7 @@ export default class HisoutensokuJammerPlugin implements OnApply {
const currentTime = moment(); const currentTime = moment();
while (moment().diff(currentTime) <= this.config.attackTimeout) { while (moment().diff(currentTime) <= this.config.attackTimeout) {
const attacker = new Attacker(address, port, 1000); const attacker = new Attacker(address, port, 1000);
let err; let err: string;
try { try {
err = await attacker.attack(); err = await attacker.attack();
} catch (e) { } catch (e) {
...@@ -214,8 +214,8 @@ export default class HisoutensokuJammerPlugin implements OnApply { ...@@ -214,8 +214,8 @@ export default class HisoutensokuJammerPlugin implements OnApply {
this.log.warn(`Attack of ${address}:${port} failed: ${err}`); this.log.warn(`Attack of ${address}:${port} failed: ${err}`);
} else { } else {
this.log.info(`Attack of ${address}:${port} succeeded.`); this.log.info(`Attack of ${address}:${port} succeeded.`);
await new Promise<void>((resolve) => setTimeout(resolve, 10));
} }
await new Promise<void>((resolve) => setTimeout(resolve, 10));
} }
this.log.info(`Attack of ${address}:${port} finished.`); this.log.info(`Attack of ${address}:${port} finished.`);
return true; return true;
......
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