Skip to content

Commit 4f71655

Browse files
committed
TUN-8275: Skip write timeout log on "no network activity"
## Summary To avoid having to verbose logs we need to only log when an actual issue occurred. Therefore, we will be skipping any error logging if the write timeout is caused by no network activity which just means that nothing is being sent through the stream.
1 parent a36fa07 commit 4f71655

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

quic/safe_stream.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/rs/zerolog/log"
1212
)
1313

14+
// The error that is throw by the writer when there is `no network activity`.
15+
var idleTimeoutError = quic.IdleTimeoutError{}
16+
1417
type SafeStreamCloser struct {
1518
lock sync.Mutex
1619
stream quic.Stream
@@ -52,7 +55,10 @@ func (s *SafeStreamCloser) handleTimeout(err error) {
5255
var netErr net.Error
5356
if errors.As(err, &netErr) {
5457
if netErr.Timeout() {
55-
s.log.Error().Err(netErr).Msg("Closing quic stream due to timeout while writing")
58+
// We don't need to log if what cause the timeout was `no network activity`.
59+
if !errors.Is(netErr, &idleTimeoutError) {
60+
s.log.Error().Err(netErr).Msg("Closing quic stream due to timeout while writing")
61+
}
5662
s.stream.CancelWrite(0)
5763
}
5864
}

0 commit comments

Comments
 (0)