Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1799 from Bytom/fix_p2p_log_level
Browse files Browse the repository at this point in the history
modify p2p network log level
  • Loading branch information
Paladz authored Oct 24, 2019
2 parents 57d7096 + 727d644 commit 280ddc9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions p2p/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ func (sw *Switch) DialPeerWithAddress(addr *NetAddress) error {

pc, err := newOutboundPeerConn(addr, sw.nodePrivKey, sw.peerConfig)
if err != nil {
log.WithFields(log.Fields{"module": logModule, "address": addr, " err": err}).Error("DialPeer fail on newOutboundPeerConn")
log.WithFields(log.Fields{"module": logModule, "address": addr, " err": err}).Warn("DialPeer fail on newOutboundPeerConn")
return err
}

if err = sw.AddPeer(pc, addr.isLAN); err != nil {
log.WithFields(log.Fields{"module": logModule, "address": addr, " err": err}).Error("DialPeer fail on switch AddPeer")
log.WithFields(log.Fields{"module": logModule, "address": addr, " err": err}).Warn("DialPeer fail on switch AddPeer")
pc.CloseConn()
return err
}
Expand Down Expand Up @@ -329,14 +329,14 @@ func (sw *Switch) addPeerWithConnection(conn net.Conn) error {
peerConn, err := newInboundPeerConn(conn, sw.nodePrivKey, sw.Config.P2P)
if err != nil {
if err := conn.Close(); err != nil {
log.WithFields(log.Fields{"module": logModule, "remote peer:": conn.RemoteAddr().String(), " err:": err}).Error("closes connection err")
log.WithFields(log.Fields{"module": logModule, "remote peer:": conn.RemoteAddr().String(), " err:": err}).Warn("closes connection err")
}
return err
}

if err = sw.AddPeer(peerConn, false); err != nil {
if err := conn.Close(); err != nil {
log.WithFields(log.Fields{"module": logModule, "remote peer:": conn.RemoteAddr().String(), " err:": err}).Error("closes connection err")
log.WithFields(log.Fields{"module": logModule, "remote peer:": conn.RemoteAddr().String(), " err:": err}).Warn("closes connection err")
}
return err
}
Expand Down Expand Up @@ -399,7 +399,7 @@ func (sw *Switch) listenerRoutine(l Listener) {
// disconnect if we alrady have MaxNumPeers
if sw.peers.Size() >= sw.Config.P2P.MaxNumPeers {
if err := inConn.Close(); err != nil {
log.WithFields(log.Fields{"module": logModule, "remote peer:": inConn.RemoteAddr().String(), " err:": err}).Error("closes connection err")
log.WithFields(log.Fields{"module": logModule, "remote peer:": inConn.RemoteAddr().String(), " err:": err}).Warn("closes connection err")
}
log.Info("Ignoring inbound connection: already have enough peers.")
continue
Expand All @@ -415,7 +415,7 @@ func (sw *Switch) listenerRoutine(l Listener) {

func (sw *Switch) dialPeerWorker(a *NetAddress, wg *sync.WaitGroup) {
if err := sw.DialPeerWithAddress(a); err != nil {
log.WithFields(log.Fields{"module": logModule, "addr": a, "err": err}).Error("dialPeerWorker fail on dial peer")
log.WithFields(log.Fields{"module": logModule, "addr": a, "err": err}).Warn("dialPeerWorker fail on dial peer")
}
wg.Done()
}
Expand Down

0 comments on commit 280ddc9

Please sign in to comment.