mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +00:00
Replace deprecated substr with substring (#355)
* Make the QueryRunner more readable * Remove use of deprecated substr and replace with substring, and some formatting
This commit is contained in:
parent
65dd876252
commit
5b01e1be17
9 changed files with 66 additions and 61 deletions
|
|
@ -26,8 +26,8 @@ class GlobalUdpSocket {
|
|||
log(fromAddress + ':' + fromPort + " <--UDP(" + this.port + ")");
|
||||
log(HexUtil.debugDump(buffer));
|
||||
});
|
||||
for (const cb of this.callbacks) {
|
||||
cb(fromAddress, fromPort, buffer);
|
||||
for (const callback of this.callbacks) {
|
||||
callback(fromAddress, fromPort, buffer);
|
||||
}
|
||||
});
|
||||
udpSocket.on('error', e => {
|
||||
|
|
@ -42,12 +42,14 @@ class GlobalUdpSocket {
|
|||
|
||||
async send(buffer, address, port, debug) {
|
||||
const socket = await this._getSocket();
|
||||
|
||||
if (debug) {
|
||||
this.logger._print(log => {
|
||||
log(address + ':' + port + " UDP(" + this.port + ")-->");
|
||||
log(HexUtil.debugDump(buffer));
|
||||
});
|
||||
}
|
||||
|
||||
await util.promisify(socket.send).bind(socket)(buffer,0,buffer.length,port,address);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue