Compare commits
No commits in common. "05c9a7aea7a0e75d4a2a24cc251f59bb2aa4c1f0" and "788591b227e91c7ecdfe32ef99865239386ed090" have entirely different histories.
05c9a7aea7
...
788591b227
|
@ -42,7 +42,7 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
|||
}
|
||||
this._relay = socket;
|
||||
await socket.opened;
|
||||
const rpc = await setupStream(socket);
|
||||
const rpc = setupStream(socket);
|
||||
if (this._query.bypassCache) {
|
||||
delete this._query.bypassCache;
|
||||
await this.queryRpc(rpc, {
|
||||
|
|
|
@ -14,6 +14,6 @@ export declare function validateTimestampedResponse(
|
|||
): boolean;
|
||||
export declare function hashQuery(query: RPCRequest): string;
|
||||
export declare function createHash(data: string): Buffer;
|
||||
export declare function setupStream(stream: any): Promise<any>;
|
||||
export declare function setupStream(stream: any): any;
|
||||
export declare function maybeGetAsyncProperty(object: any): Promise<any>;
|
||||
//# sourceMappingURL=util.d.ts.map
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOxE,eAAO,MAAM,mBAAmB,eAAwB,CAAC;AAEzD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,WAM1C;AAKD,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,GAAG,GAAG,EAAE,CA0C1D;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,WAAW,EACrB,WAAW,UAAQ,GAClB,OAAO,CAkBT;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,WAAW,GACpB,OAAO,CAET;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAUnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,gBAa5C;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,GAAG,gBAUtD"}
|
||||
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOxE,eAAO,MAAM,mBAAmB,eAAwB,CAAC;AAEzD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,WAM1C;AAKD,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,GAAG,GAAG,EAAE,CA0C1D;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,WAAW,EACrB,WAAW,UAAQ,GAClB,OAAO,CAkBT;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,WAAW,GACpB,OAAO,CAET;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAUnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,OAStC;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,GAAG,gBAUtD"}
|
|
@ -80,16 +80,13 @@ export function createHash(data) {
|
|||
sodium.crypto_generichash(hash, buffer);
|
||||
return hash;
|
||||
}
|
||||
export async function setupStream(stream) {
|
||||
export function setupStream(stream) {
|
||||
const existing = stream[RPC_PROTOCOL_SYMBOL];
|
||||
if (!existing) {
|
||||
await existing._channel.ready;
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const rpc = new RPC(stream);
|
||||
stream[RPC_PROTOCOL_SYMBOL] = rpc;
|
||||
await existing.ready;
|
||||
return rpc;
|
||||
stream[RPC_PROTOCOL_SYMBOL] = new RPC(stream);
|
||||
return stream[RPC_PROTOCOL_SYMBOL];
|
||||
}
|
||||
export async function maybeGetAsyncProperty(object) {
|
||||
if (typeof object === "function") {
|
||||
|
|
|
@ -75,7 +75,7 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
|||
|
||||
await socket.opened;
|
||||
|
||||
const rpc = await setupStream(socket);
|
||||
const rpc = setupStream(socket);
|
||||
|
||||
if (this._query.bypassCache) {
|
||||
delete this._query.bypassCache;
|
||||
|
|
12
src/util.ts
12
src/util.ts
|
@ -115,19 +115,15 @@ export function createHash(data: string): Buffer {
|
|||
return hash;
|
||||
}
|
||||
|
||||
export async function setupStream(stream: any) {
|
||||
export function setupStream(stream: any) {
|
||||
const existing = stream[RPC_PROTOCOL_SYMBOL];
|
||||
if (!existing) {
|
||||
await existing._channel.ready;
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
const rpc = new RPC(stream);
|
||||
stream[RPC_PROTOCOL_SYMBOL] = rpc;
|
||||
stream[RPC_PROTOCOL_SYMBOL] = new RPC(stream);
|
||||
|
||||
await existing.ready;
|
||||
|
||||
return rpc;
|
||||
return stream[RPC_PROTOCOL_SYMBOL];
|
||||
}
|
||||
|
||||
export async function maybeGetAsyncProperty(object: any) {
|
||||
|
|
Loading…
Reference in New Issue