*Add safety check on timer
This commit is contained in:
parent
b00e598c07
commit
cc5c988ce7
|
@ -79,9 +79,11 @@ export default class RpcQuery {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let timer: NodeJS.Timeout;
|
let timer: any;
|
||||||
socket.on("data", (res: Buffer) => {
|
socket.on("data", (res: Buffer) => {
|
||||||
clearTimeout(timer);
|
if (timer && timer.close) {
|
||||||
|
clearTimeout(timer as any);
|
||||||
|
}
|
||||||
socket.end();
|
socket.end();
|
||||||
const response = unpack(res as any) as RPCResponse;
|
const response = unpack(res as any) as RPCResponse;
|
||||||
if (response && response.error) {
|
if (response && response.error) {
|
||||||
|
|
Loading…
Reference in New Issue