peer: fix potential memory leak.

This commit is contained in:
Christopher Jeffrey 2017-01-27 18:10:07 -08:00
parent b7f0a1fb79
commit 695509b1b3
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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;