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.
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.