Skip to content

Commit

Permalink
Move logs to swarm
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Jul 1, 2022
1 parent 94ff2c2 commit 475dde5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions p2p/net/swarm/swarm_dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"
"time"

"github.com/libp2p/go-libp2p-core/canonicallog"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/transport"
Expand Down Expand Up @@ -387,6 +388,7 @@ func (s *Swarm) dialAddr(ctx context.Context, p peer.ID, addr ma.Multiaddr) (tra
if err != nil {
return nil, err
}
canonicallog.LogPeerStatus(100, connC.RemotePeer(), connC.RemoteMultiaddr(), "connection_status", "established", "dir", "inbound")

// Trust the transport? Yeah... right.
if connC.RemotePeer() != p {
Expand Down
2 changes: 2 additions & 0 deletions p2p/net/swarm/swarm_listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"time"

"github.com/libp2p/go-libp2p-core/canonicallog"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/transport"

Expand Down Expand Up @@ -124,6 +125,7 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
if err != nil {
return
}
canonicallog.LogPeerStatus(100, c.RemotePeer(), c.RemoteMultiaddr(), "connection_status", "established", "dir", "outbound")

log.Debugf("swarm listener accepted connection: %s", c)
s.refs.Add(1)
Expand Down
3 changes: 0 additions & 3 deletions p2p/net/upgrader/upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/libp2p/go-libp2p/p2p/net/pnet"

"github.com/libp2p/go-libp2p-core/canonicallog"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
Expand Down Expand Up @@ -178,8 +177,6 @@ func (u *upgrader) upgrade(ctx context.Context, t transport.Transport, maconn ma
return nil, fmt.Errorf("failed to negotiate stream multiplexer: %s", err)
}

canonicallog.LogPeerStatus(100, sconn.RemotePeer(), maconn.RemoteMultiaddr(), "connection_status", "established")

tc := &transportConn{
MuxedConn: smconn,
ConnMultiaddrs: maconn,
Expand Down

0 comments on commit 475dde5

Please sign in to comment.