mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
veb: handle sendfile errors, when the connection is canceled, before the file is completely transferred (#23891)
This commit is contained in:
parent
81afd8f502
commit
6cda3b0ab3
1 changed files with 5 additions and 1 deletions
|
@ -254,7 +254,11 @@ fn handle_write_file(mut pv picoev.Picoev, mut params RequestParams, fd int) {
|
|||
|
||||
$if linux || freebsd {
|
||||
bytes_written := sendfile(fd, params.file_responses[fd].file.fd, bytes_to_write)
|
||||
params.file_responses[fd].pos += bytes_written
|
||||
if bytes_written < 0 {
|
||||
params.file_responses[fd].pos += bytes_to_write
|
||||
} else {
|
||||
params.file_responses[fd].pos += bytes_written
|
||||
}
|
||||
} $else {
|
||||
if bytes_to_write > max_write {
|
||||
bytes_to_write = max_write
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue