Change disconnect log level to INFO (#1549)

* Change disconnect log level to INFO

* Add disconnected log and change log levels
This commit is contained in:
Ori Newman 2021-02-23 13:52:47 +02:00 committed by GitHub
parent bee0893660
commit 9ffda2b1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -89,7 +89,7 @@ func (m *Manager) handleError(err error, netConnection *netadapter.NetConnection
panic(err)
}
}
log.Debugf("Disconnecting from %s (reason: %s)", netConnection, protocolErr.Cause)
log.Infof("Disconnecting from %s (reason: %s)", netConnection, protocolErr.Cause)
netConnection.Disconnect()
return
}

View File

@ -29,6 +29,7 @@ func newNetConnection(connection server.Connection, routerInitializer RouterInit
}
netConnection.connection.SetOnDisconnectedHandler(func() {
log.Infof("Disconnected from %s", netConnection)
// If the disconnection came because of a network error and not because of the application layer, we
// need to close the router as well.
if atomic.AddUint32(&netConnection.isRouterClosed, 1) == 1 {

View File

@ -37,7 +37,7 @@ func (p *p2pServer) MessageStream(stream protowire.P2P_MessageStreamServer) erro
// Connect connects to the given address
// This is part of the P2PServer interface
func (p *p2pServer) Connect(address string) (server.Connection, error) {
log.Infof("%s Dialing to %s", p.name, address)
log.Debugf("%s Dialing to %s", p.name, address)
const dialTimeout = 30 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), dialTimeout)