rpc: watch for peer death on apply

This commit is contained in:
Koushik Dutta
2022-01-07 09:55:29 -08:00
parent 28d7a648d3
commit 182ed6ad71

View File

@@ -135,6 +135,9 @@ class RpcProxy implements PrimitiveProxyHandler<any> {
}
apply(target: any, thisArg: any, argArray?: any): any {
if (Object.isFrozen(this.peer.pendingResults))
return Promise.reject(new RPCResultError(this.peer, 'RpcPeer has been killed'));
// rpc objects can be functions. if the function is a oneway method,
// it will have a null in the oneway method list. this is because
// undefined is not JSON serializable.