parent
1d73d23700
commit
a226c7deea
|
@ -10,7 +10,6 @@ export default abstract class RpcQueryBase {
|
||||||
protected _promise?: Promise<any>;
|
protected _promise?: Promise<any>;
|
||||||
protected _timeoutTimer?: any;
|
protected _timeoutTimer?: any;
|
||||||
protected _timeout: boolean;
|
protected _timeout: boolean;
|
||||||
protected _timeoutCanceled: boolean;
|
|
||||||
protected _completed: boolean;
|
protected _completed: boolean;
|
||||||
protected _responses: {
|
protected _responses: {
|
||||||
[relay: string]: RPCResponse;
|
[relay: string]: RPCResponse;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/query/base.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IACxC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEpC,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,CAAC;IAC9B,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAS;IACpC,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAS;IAC5C,SAAS,CAAC,UAAU,EAAE,OAAO,CAAS;IACtC,SAAS,CAAC,UAAU,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAM;IAC5D,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,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CAAS;IACtC,SAAS,CAAC,UAAU,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAM;IAC5D,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAM;IACjD,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;gBAG9C,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,eAAoB;IAO/B,IAAI,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,CAEjC;IAED,OAAO,CAAC,YAAY;IAIpB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,GAAE,OAAe,GAAG,IAAI;IAc9D,GAAG,IAAI,IAAI;cA2BF,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoDhE,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;IAEzC,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,MAAM,EAAE,GAAG,MAAM,EAAE;CACpD"}
|
|
@ -9,7 +9,6 @@ export default class RpcQueryBase {
|
||||||
_promise;
|
_promise;
|
||||||
_timeoutTimer;
|
_timeoutTimer;
|
||||||
_timeout = false;
|
_timeout = false;
|
||||||
_timeoutCanceled = false;
|
|
||||||
_completed = false;
|
_completed = false;
|
||||||
_responses = {};
|
_responses = {};
|
||||||
_errors = {};
|
_errors = {};
|
||||||
|
@ -23,9 +22,6 @@ export default class RpcQueryBase {
|
||||||
return this._promise;
|
return this._promise;
|
||||||
}
|
}
|
||||||
handeTimeout() {
|
handeTimeout() {
|
||||||
if (this._timeoutCanceled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.resolve(undefined, true);
|
this.resolve(undefined, true);
|
||||||
}
|
}
|
||||||
resolve(data, timeout = false) {
|
resolve(data, timeout = false) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../src/query/streaming.ts"],"names":[],"mappings":";AAAA,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,sBAAsB,CAAC;AACpE,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,cAAc;IAC3D,SAAS,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC7C,SAAS,CAAC,SAAS,UAAS;gBAE1B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,wBAAwB;IAM5B,MAAM;cAIG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAgEjE"}
|
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../src/query/streaming.ts"],"names":[],"mappings":";AAAA,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,sBAAsB,CAAC;AACpE,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,cAAc;IAC3D,SAAS,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC7C,SAAS,CAAC,SAAS,UAAS;gBAE1B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,wBAAwB;IAM5B,MAAM;cAIG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAmEjE"}
|
|
@ -1,6 +1,7 @@
|
||||||
import SimpleRpcQuery from "./simple.js";
|
import SimpleRpcQuery from "./simple.js";
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { isPromise } from "../util.js";
|
import { isPromise } from "../util.js";
|
||||||
|
import { clearTimeout } from "timers";
|
||||||
import { pack, unpack } from "msgpackr";
|
import { pack, unpack } from "msgpackr";
|
||||||
export default class StreamingRpcQuery extends SimpleRpcQuery {
|
export default class StreamingRpcQuery extends SimpleRpcQuery {
|
||||||
_options;
|
_options;
|
||||||
|
@ -40,7 +41,10 @@ export default class StreamingRpcQuery extends SimpleRpcQuery {
|
||||||
};
|
};
|
||||||
const listener = (res) => {
|
const listener = (res) => {
|
||||||
relay = relay;
|
relay = relay;
|
||||||
this._timeoutCanceled = true;
|
if (this._timeoutTimer) {
|
||||||
|
clearTimeout(this._timeoutTimer);
|
||||||
|
this._timeoutTimer = null;
|
||||||
|
}
|
||||||
if (this._canceled) {
|
if (this._canceled) {
|
||||||
socket.write(pack({ cancel: true }));
|
socket.write(pack({ cancel: true }));
|
||||||
socket.off("data", listener);
|
socket.off("data", listener);
|
||||||
|
|
Loading…
Reference in New Issue