mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
Additional async rewrite
This commit is contained in:
parent
efe12a00aa
commit
29ce0b82d0
24 changed files with 654 additions and 470 deletions
|
|
@ -2,12 +2,6 @@ const gbxremote = require('gbxremote'),
|
|||
Core = require('./core');
|
||||
|
||||
class Nadeo extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.options.port = 2350;
|
||||
this.options.port_query = 5000;
|
||||
}
|
||||
|
||||
async run(state) {
|
||||
await this.withClient(async client => {
|
||||
await this.methodCall(client, 'Authenticate', this.options.login, this.options.password);
|
||||
|
|
@ -57,8 +51,8 @@ class Nadeo extends Core {
|
|||
}
|
||||
|
||||
async withClient(fn) {
|
||||
const socket = gbxremote.createClient(this.options.port_query, this.options.host);
|
||||
const cancelAsyncLeak = this.addAsyncLeak(() => socket.terminate());
|
||||
const socket = gbxremote.createClient(this.options.port, this.options.host);
|
||||
const cancelAsyncLeak = this.addCleanup(() => socket.terminate());
|
||||
try {
|
||||
await this.timedPromise(
|
||||
new Promise((resolve,reject) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue