diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go index 1c8201b05f..d831f0eb8d 100644 --- a/cmd/wnode/main.go +++ b/cmd/wnode/main.go @@ -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 { diff --git a/whisper/whisperv6/libp2p_glue.go b/whisper/whisperv6/libp2p_glue.go index 0adf94f20d..7f2b223977 100644 --- a/whisper/whisperv6/libp2p_glue.go +++ b/whisper/whisperv6/libp2p_glue.go @@ -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