From f909a4a89f6bf078e4a5b12a60b76e8bdc4b4f17 Mon Sep 17 00:00:00 2001 From: Yutaka Takeda Date: Sat, 30 Dec 2023 23:01:57 -0800 Subject: [PATCH] Improved debug logs Relates to #270 --- association.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/association.go b/association.go index 1ca680c4..0ab0ea66 100644 --- a/association.go +++ b/association.go @@ -329,10 +329,10 @@ func createAssociation(config Config) *Association { retryFirstWriteError: runtime.GOOS == "linux", } - a.log.Debugf("[%s] retryFirstWriteError=%v", a.name, a.retryFirstWriteError) - a.name = fmt.Sprintf("%p", a) + a.log.Debugf("[%s] retryFirstWriteError=%v", a.name, a.retryFirstWriteError) + // RFC 4690 Sec 7.2.1 // o The initial cwnd before DATA transmission or after a sufficiently // long idle period MUST be set to min(4*MTU, max (2*MTU, 4380 @@ -615,11 +615,13 @@ func (a *Association) write(packet []byte) (int, error) { if err != nil { var opErr *net.OpError if errors.As(err, &opErr) { - a.log.Debugf("write failed: op='%s' err='%s'", opErr.Op, opErr.Err.Error()) + a.log.Debugf("[%s] write failed (op='%s' err='%s'). Retrying.", a.name, opErr.Op, opErr.Err.Error()) if opErr.Op == "write" && opErr.Err.Error() == "operation not permitted" { n, err = a.netConn.Write(packet) } } + } else { + a.log.Debugf("[%s] initial write succeeded", a.name) } } return n, err