Skip to content

Commit 688d182

Browse files
cleaned unix events
Signed-off-by: grantlouisherman <grantlouisherman041@gmail.com>
1 parent ffb266b commit 688d182

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Lib/asyncio/unix_events.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,12 @@ def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
385385
# order to simplify the common case.
386386
self.remove_writer(registered_fd)
387387
if fut.cancelled():
388-
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
388+
self._sock_sendfile_update_filepos(fileno, offset)
389389
return
390390
if count:
391391
blocksize = count - total_sent
392392
if blocksize <= 0:
393-
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
393+
self._sock_sendfile_update_filepos(fileno, offset)
394394
fut.set_result(total_sent)
395395
return
396396

@@ -424,20 +424,20 @@ def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
424424
# plain send().
425425
err = exceptions.SendfileNotAvailableError(
426426
"os.sendfile call failed")
427-
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
427+
self._sock_sendfile_update_filepos(fileno, offset)
428428
fut.set_exception(err)
429429
else:
430-
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
430+
self._sock_sendfile_update_filepos(fileno, offset)
431431
fut.set_exception(exc)
432432
except (SystemExit, KeyboardInterrupt):
433433
raise
434434
except BaseException as exc:
435-
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
435+
self._sock_sendfile_update_filepos(fileno, offset)
436436
fut.set_exception(exc)
437437
else:
438438
if sent == 0:
439439
# EOF
440-
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
440+
self._sock_sendfile_update_filepos(fileno, offset)
441441
fut.set_result(total_sent)
442442
else:
443443
offset += sent
@@ -448,9 +448,9 @@ def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
448448
fd, sock, fileno,
449449
offset, count, blocksize, total_sent)
450450

451-
def _sock_sendfile_update_filepos(self, fileno, offset, total_sent):
452-
if total_sent >= 0:
453-
os.lseek(fileno, offset, os.SEEK_SET)
451+
def _sock_sendfile_update_filepos(self, fileno, offset):
452+
# After this helper runs, the source fd's lseek pointer is at offset."
453+
os.lseek(fileno, offset, os.SEEK_SET)
454454

455455
def _sock_add_cancellation_callback(self, fut, sock):
456456
def cb(fut):

0 commit comments

Comments
 (0)