net: fix destroy check.
This commit is contained in:
parent
f4f4f2b433
commit
0e234c7c3a
@ -1052,9 +1052,6 @@ Peer.prototype.getData = function getData(items) {
|
||||
Peer.prototype._onPacket = co(function* onPacket(packet) {
|
||||
var unlock;
|
||||
|
||||
if (this.destroyed)
|
||||
throw new Error('Destroyed peer sent a packet.');
|
||||
|
||||
switch (packet.type) {
|
||||
case packetTypes.VERSION:
|
||||
case packetTypes.CMPCTBLOCK:
|
||||
@ -1082,6 +1079,9 @@ Peer.prototype._onPacket = co(function* onPacket(packet) {
|
||||
Peer.prototype.__onPacket = co(function* onPacket(packet) {
|
||||
this.lastRecv = util.ms();
|
||||
|
||||
if (this.destroyed)
|
||||
throw new Error('Destroyed peer sent a packet.');
|
||||
|
||||
if (this.bip151
|
||||
&& !this.bip151.completed
|
||||
&& packet.type !== packetTypes.ENCINIT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user