diff --git a/lib/net/peer.js b/lib/net/peer.js index d628ac8a..57aa71e0 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -1504,7 +1504,8 @@ Peer.prototype.readPacket = co(function* readPacket(packet) { this.socket.pause(); yield this.handlePacket(packet); } finally { - this.socket.resume(); + if (!this.destroyed) + this.socket.resume(); } break; default: @@ -1513,7 +1514,8 @@ Peer.prototype.readPacket = co(function* readPacket(packet) { this.socket.pause(); yield this.handlePacket(packet); } finally { - this.socket.resume(); + if (!this.destroyed) + this.socket.resume(); unlock(); } break;