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