Skip to content

Commit

Permalink
Add more debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
enobufs committed Dec 31, 2023
1 parent 2b8b763 commit 2d16a5b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions association.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 2d16a5b

Please sign in to comment.