Skip to content

Commit 7932b51

Browse files
committed
fix(p2p): prevent xud from crashing when connecting to peer timeouts
1 parent 2824482 commit 7932b51

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/grpc/GrpcService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ class GrpcService {
171171
case p2pErrorCodes.POOL_CLOSED:
172172
code = status.ABORTED;
173173
break;
174+
case p2pErrorCodes.RESPONSE_TIMEOUT:
175+
code = status.DEADLINE_EXCEEDED;
176+
break;
174177
}
175178

176179
// return a grpc error with the code if we've assigned one, otherwise pass along the caught error as UNKNOWN

lib/p2p/Peer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ class Peer extends EventEmitter {
580580
const request = PacketType[parseInt(packetId, 10)] || packetId;
581581
const err = errors.RESPONSE_TIMEOUT(request);
582582
this.emitError(err.message);
583-
entry.reject(err.message);
583+
entry.reject(err);
584584
await this.close(DisconnectionReason.ResponseStalling, packetId);
585585
}
586586
}

0 commit comments

Comments
 (0)