diff --git a/association.go b/association.go index ce3725ec..b9185f70 100644 --- a/association.go +++ b/association.go @@ -507,6 +507,8 @@ func (a *Association) closeAllTimers() { func (a *Association) readLoop() { var closeErr error + + a.log.Debugf("[%s] readLoop entered", a.name) defer func() { // also stop writeLoop, otherwise writeLoop can be leaked // if connection is lost when there is no writing packet. @@ -526,9 +528,14 @@ func (a *Association) readLoop() { a.log.Debugf("[%s] stats nT3Timeouts : %d", a.name, a.stats.getNumT3Timeouts()) a.log.Debugf("[%s] stats nAckTimeouts: %d", a.name, a.stats.getNumAckTimeouts()) a.log.Debugf("[%s] stats nFastRetrans: %d", a.name, a.stats.getNumFastRetrans()) + + if errors.Is(closeErr, net.ErrClosed) || errors.Is(closeErr, io.EOF) { + a.log.Debugf("[%s] readLoop exited %s", a.name, closeErr) + } else { + a.log.Errorf("[%s] readLoop exited %s", a.name, closeErr) + } }() - a.log.Debugf("[%s] readLoop entered", a.name) buffer := make([]byte, receiveMTU) for { @@ -549,8 +556,6 @@ func (a *Association) readLoop() { break } } - - a.log.Debugf("[%s] readLoop exited %s", a.name, closeErr) } func (a *Association) writeLoop() {