Open fanatid opened 9 years ago
If there was a check, it would still throw an error though. It could be better to check the status before sending a message and then if it's not ready, use a different peer. Alternatively peers in a pool are removed when they are disconnected, and pool.sendMessage
will send to all the connected peers.
I think custom error is better than This socket is closed
because node.js process will be alive.
Thanks for hint about connected peers in Pool
, I'll see.
Check connection status before write? https://github.com/bitpay/bitcore-p2p/blob/master/lib/peer.js#L194
Result: