Some code tidy and migrate simple promises to async/await

This commit is contained in:
Casper Warden
2018-10-06 15:29:06 +01:00
parent 7a3643018a
commit f5e3df4ebf
6 changed files with 57 additions and 63 deletions

View File

@@ -6,7 +6,7 @@ export class NetworkCommands extends CommandsBase
{
private throttleGenCounter = 0;
setBandwidth(total: number)
async setBandwidth(total: number): Promise<void>
{
const agentThrottle: AgentThrottleMessage = new AgentThrottleMessage();
agentThrottle.AgentData = {
@@ -45,6 +45,7 @@ export class NetworkCommands extends CommandsBase
GenCounter: this.throttleGenCounter++,
Throttles: throttleData
};
this.circuit.sendMessage(agentThrottle, PacketFlags.Reliable);
const sequenceNo = this.circuit.sendMessage(agentThrottle, PacketFlags.Reliable);
return await this.circuit.waitForAck(sequenceNo, 10000);
}
}