mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-01 18:00:46 +01:00
goroutine-based context-cancellable I/O + aggressive goroutine timeouts
This commit is contained in:
1 parent
48803d9a68
commit
75ffd30a03
1 file changed
+5
@@ -291,6 +291,11 @@ func (h *Handler) HandleConn(ctx context.Context, conn net.Conn) error {
|
||||
readChan := make(chan readResult, 1)
|
||||
|
||||
go func() {
|
||||
// Set a very short deadline for this specific read to prevent hanging
|
||||
if err := conn.SetReadDeadline(time.Now().Add(1 * time.Second)); err != nil {
|
||||
readChan <- readResult{n: 0, err: err}
|
||||
return
|
||||
}
|
||||
n, err := io.ReadFull(r, sizeBytes[:])
|
||||
readChan <- readResult{n: n, err: err}
|
||||
}()
|
||||
|
||||
Reference in new issue
Block a user