mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
whisper: update the peercount
The new peer was timing out because the peer list wasn't updated.
This commit is contained in:
parent
5e5ae75be5
commit
80d093ddd4
2 changed files with 6 additions and 11 deletions
|
|
@ -226,7 +226,7 @@ func initialize() {
|
|||
if err != nil {
|
||||
utils.Fatalf("Error parsing the bootnode addr: %v", err)
|
||||
}
|
||||
fmt.Println(libp2pbootaddr)
|
||||
fmt.Println("bootstrap addr: ", libp2pbootaddr)
|
||||
libp2pPeers = append(libp2pPeers, libp2pbootaddr)
|
||||
} else {
|
||||
if len(*argEnode) == 0 {
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ func (server *LibP2PWhisperServer) connectToPeer(p *LibP2PPeer) error {
|
|||
// Create a stream with the peer
|
||||
s, err := server.Host.NewStream(context.Background(), p.id, WhisperProtocolString)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Save the stream
|
||||
|
|
@ -181,15 +181,10 @@ func (server *LibP2PWhisperServer) connectToPeer(p *LibP2PPeer) error {
|
|||
}
|
||||
p.connectionStream = &lps
|
||||
|
||||
// Send a first message to notify the remote peer we want
|
||||
// to connect
|
||||
connectMsg := p2p.Msg{
|
||||
Code: lp2pPeerCode,
|
||||
Size: 0,
|
||||
Payload: bytes.NewReader([]byte{0}),
|
||||
}
|
||||
// If we got here, it means that a connection was established.
|
||||
// Save the peer.
|
||||
|
||||
err = lps.WriteMsg(connectMsg)
|
||||
// TODO send my known list of peers
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
@ -245,7 +240,7 @@ func (server *LibP2PWhisperServer) Stop() {
|
|||
|
||||
// PeerCount returns the peer count for the node
|
||||
func (server *LibP2PWhisperServer) PeerCount() int {
|
||||
return 0
|
||||
return len(server.Peers)
|
||||
}
|
||||
|
||||
// Enode returns the enode address of the node
|
||||
|
|
|
|||
Loading…
Reference in a new issue