Replace error message to ctx.Err()

This commit is contained in:
Zoltan Papp 2024-08-22 23:04:38 +02:00
parent 3d81a0a07d
commit f28b4555b5

View File

@ -2,7 +2,6 @@ package server
import (
"context"
"fmt"
"io"
"net"
"sync"
@ -130,7 +129,7 @@ func (p *Peer) writeWithTimeout(ctx context.Context, buf []byte) (int, error) {
select {
case <-ctx.Done():
return 0, fmt.Errorf("write operation timed out")
return 0, ctx.Err()
case <-writeDone:
return n, err
}