pingtesterooni
parent
94c9edf473
commit
94037e7de0
|
|
@ -74,11 +74,12 @@ class Gateway {
|
||||||
client.on('ready', async () => {
|
client.on('ready', async () => {
|
||||||
while(pings.length < maxPings) {
|
while(pings.length < maxPings) {
|
||||||
interactive.info(`[${pings.length + 1}/${maxPings}] Testing connection...`);
|
interactive.info(`[${pings.length + 1}/${maxPings}] Testing connection...`);
|
||||||
// pings.push(await client.ping());
|
pings.push(await client.ping());
|
||||||
pings.push(10);
|
// pings.push(10);
|
||||||
await new Promise(res => setTimeout(res, 1000));
|
await new Promise(res => setTimeout(res, 500));
|
||||||
}
|
}
|
||||||
interactive.success(`Test complete. Average Ping: ${pings.reduce((a, v) => a += (v / maxPings), 0)}`)
|
const average = Math.round(pings.reduce((a, v) => a + v, 0) / maxPings);
|
||||||
|
interactive.success(`Test complete. Average Ping: ${average}`)
|
||||||
client.tcpSocket.destroy();
|
client.tcpSocket.destroy();
|
||||||
res();
|
res();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,13 @@ class STPSocket extends EventEmitter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.readyState === this.SECURED && obj.cmd === 'PONG') {
|
||||||
|
if (this.pingCallbacks.has(obj.data.id)) {
|
||||||
|
this.pingCallbacks.get(obj.data.id)();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handshake() {
|
handshake() {
|
||||||
|
|
|
||||||
Reference in New Issue