From d6c4aa215ecf910d2767210d1a0dcc195fcc0afd Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Wed, 1 Aug 2018 15:09:07 -0700 Subject: [PATCH 1/2] pkg: bump bsock and bweb with timeout fixes --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 68c46564..05ecfa7f 100644 --- a/package.json +++ b/package.json @@ -39,14 +39,14 @@ "bmutex": "~0.1.0", "bn.js": "~4.11.8", "bsip": "~0.1.0", - "bsock": "~0.1.0", + "bsock": "~0.1.2", "bsocks": "~0.2.0", "bstring": "~0.1.0", "btcp": "~0.1.0", "bufio": "~0.2.0", "bupnp": "~0.2.1", "bval": "~0.1.0", - "bweb": "~0.1.1", + "bweb": "~0.1.3", "mrmr": "~0.1.0", "n64": "~0.2.0" }, From 7ea95b5795224a24f182f02cc3a4db6079b0ebdc Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Tue, 31 Jul 2018 19:03:17 -0700 Subject: [PATCH 2/2] net: revolve pending broadcast items If `pool.close()` is called if the pool is not connected, timers won't be cleared. Transactions can be added to the pool while it's not connected. --- lib/net/pool.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/net/pool.js b/lib/net/pool.js index 74c8d670..3786ca56 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -191,6 +191,10 @@ class Pool extends EventEmitter { async close() { assert(this.opened, 'Pool is not open.'); this.opened = false; + + for (const item of this.invMap.values()) + item.resolve(); + return this.disconnect(); } @@ -288,9 +292,6 @@ class Pool extends EventEmitter { this.disconnecting = true; - for (const item of this.invMap.values()) - item.resolve(); - this.peers.destroy(); this.blockMap.clear();