move logging of connection closing to the session

This commit is contained in:
Marten Seemann
2018-05-10 13:12:02 +09:00
parent 9cc23135d0
commit c7119b2adf
2 changed files with 2 additions and 2 deletions

View File

@@ -248,7 +248,6 @@ func (c *client) establishSecureConnection() error {
go func() {
runErr = c.session.run() // returns as soon as the session is closed
close(errorChan)
c.logger.Infof("Connection %s closed.", c.srcConnID)
if runErr != handshake.ErrCloseSessionForRetry && runErr != errCloseSessionForNewVersion {
c.conn.Close()
}

View File

@@ -533,6 +533,7 @@ runLoop:
s.handshakeChan <- closeErr.err
}
s.handleCloseError(closeErr)
s.logger.Infof("Connection %s closed.", s.srcConnID)
return closeErr.err
}
@@ -839,7 +840,7 @@ func (s *session) handleCloseError(closeErr closeError) error {
}
// Don't log 'normal' reasons
if quicErr.ErrorCode == qerr.PeerGoingAway || quicErr.ErrorCode == qerr.NetworkIdleTimeout {
s.logger.Infof("Closing connection %s", s.srcConnID)
s.logger.Infof("Closing connection %s.", s.srcConnID)
} else {
s.logger.Errorf("Closing session with error: %s", closeErr.err.Error())
}