Skip to content

Commit

Permalink
read deadline
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Feb 1, 2025
1 parent 4718a04 commit 9954d98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions handlers/scraper/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ func handleConnection(conn net.Conn) {
}
}

if err := conn.SetReadDeadline(time.Now().Add(3 * time.Second)); err != nil {
slog.Error("failed to set deadline", "err", err)
rm.outChan <- err
return
}

outBuf := make([]byte, 1024*1024)
n, err := conn.Read(outBuf)
if err != nil {
Expand Down

0 comments on commit 9954d98

Please sign in to comment.