mafintosh / peer-wire-swarm

swarm implementation for bittorrent
MIT License
80 stars 18 forks source link

Use wire 'close' instead of wire 'end' #16

Open Ivshti opened 9 years ago

Ivshti commented 9 years ago

It seems that when a connection dies, 'close' gets emitted every time while 'end' for some reason doesn't. I looked at things and I think 'end' won't get emitted if the connection is never opened, so 'close' makes more sense.

With 'end' we get a lot of peers which are stuck indefinitely in _peers, and we don't try reconnecting and we can't even re-add them to the swarm.

Just close this if it's chosen deliberately over 'close', just explain it in a comment.