Skip to content

Commit

Permalink
print inbound peers for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Jun 24, 2024
1 parent 9a954c6 commit 161d5c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions p2p/pex/pex_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ func (r *Reactor) GetChannels() []*conn.ChannelDescriptor {
// AddPeer implements Reactor by adding peer to the address book (if inbound)
// or by requesting more addresses (if outbound).
func (r *Reactor) AddPeer(p Peer) {
// TODO REMOVE
r.Switch.InboundPeers()

if p.IsOutbound() {
// For outbound peers, the address is already in the books -
// either via DialPeersAsync or r.Receive.
Expand Down
14 changes: 14 additions & 0 deletions p2p/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,20 @@ func (sw *Switch) NumPeers() (outbound, inbound, dialing int) {
return
}

// TODO DELETE
func (sw *Switch) InboundPeers() {
peers := sw.peers.List()
count := 0
for _, peer := range peers {
if !peer.IsOutbound() {
fmt.Println("inbound peer IP: ", peer.RemoteIP().String())
count++
}
}
fmt.Println("count of inbound peers: ", count)
fmt.Println()
}

func (sw *Switch) IsPeerUnconditional(id ID) bool {
_, ok := sw.unconditionalPeerIDs[id]
return ok
Expand Down

0 comments on commit 161d5c9

Please sign in to comment.