good morning!!!!

Skip to content
Snippets Groups Projects
Commit 52b664b0 authored by Maran Hidskes's avatar Maran Hidskes
Browse files

Removed peers from peerlist as soon as they disconnect. Might fix #13

We used to wait for the reaping timer to clean up the peerlist, not any longer
parent 8fe08646
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package eth
import (
"bytes"
"container/list"
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
......@@ -515,6 +516,15 @@ func (p *Peer) Stop() {
p.writeMessage(ethwire.NewMessage(ethwire.MsgDiscTy, ""))
p.conn.Close()
}
// Pre-emptively remove the peer; don't wait for reaping. We already know it's dead if we are here
p.ethereum.peerMut.Lock()
defer p.ethereum.peerMut.Unlock()
eachPeer(p.ethereum.peers, func(peer *Peer, e *list.Element) {
if peer == p {
p.ethereum.peers.Remove(e)
}
})
}
func (p *Peer) pushHandshake() error {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment