From 2d16a5bd6c1156cadaa2abf54eef890a3a8de995 Mon Sep 17 00:00:00 2001 From: Yutaka Takeda Date: Sat, 30 Dec 2023 16:41:03 -0800 Subject: [PATCH] Add more debug logs --- association.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/association.go b/association.go index c153591c..1ca680c4 100644 --- a/association.go +++ b/association.go @@ -329,6 +329,8 @@ 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) // RFC 4690 Sec 7.2.1 @@ -612,8 +614,11 @@ func (a *Association) write(packet []byte) (int, error) { a.retryFirstWriteError = false if err != nil { var opErr *net.OpError - if errors.As(err, &opErr) && opErr.Op == "write" && opErr.Err.Error() == "operation not permitted" { - n, err = a.netConn.Write(packet) + if errors.As(err, &opErr) { + a.log.Debugf("write failed: op='%s' err='%s'", opErr.Op, opErr.Err.Error()) + if opErr.Op == "write" && opErr.Err.Error() == "operation not permitted" { + n, err = a.netConn.Write(packet) + } } } }