Skip to content

Commit

Permalink
p2p: server: include 'read/write' in deadlineAdjuster error messages (#…
Browse files Browse the repository at this point in the history
…5980)

## Motivation

P2P server messages related to deadlines were not including in the deadline related errors
  • Loading branch information
ivan4th committed May 24, 2024
1 parent 1c9b163 commit 294ffbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion p2p/server/deadline_adjuster.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
)

type deadlineAdjusterError struct {
what string
innerErr error
elapsed time.Duration
totalRead int
Expand All @@ -29,7 +30,8 @@ func (err *deadlineAdjusterError) Unwrap() error {
}

func (err *deadlineAdjusterError) Error() string {
return fmt.Sprintf("%v elapsed, %d bytes read, %d bytes written, timeout %v, hard timeout %v: %v",
return fmt.Sprintf("%s: %v elapsed, %d bytes read, %d bytes written, timeout %v, hard timeout %v: %v",
err.what,
err.elapsed,
err.totalRead,
err.totalWritten,
Expand Down Expand Up @@ -73,6 +75,7 @@ func (dadj *deadlineAdjuster) augmentError(what string, err error) error {
}

return &deadlineAdjusterError{
what: what,
innerErr: err,
elapsed: dadj.clock.Now().Sub(dadj.start),
totalRead: dadj.totalRead,
Expand Down

0 comments on commit 294ffbc

Please sign in to comment.