| 994 | file.seek(offset + total_sent) |
| 995 | |
| 996 | def _check_sendfile_params(self, sock, file, offset, count): |
| 997 | if 'b' not in getattr(file, 'mode', 'b'): |
| 998 | raise ValueError("file should be opened in binary mode") |
| 999 | if not sock.type == socket.SOCK_STREAM: |
| 1000 | raise ValueError("only SOCK_STREAM type sockets are supported") |
| 1001 | if count is not None: |
| 1002 | if not isinstance(count, int): |
| 1003 | raise TypeError( |
| 1004 | "count must be a positive integer (got {!r})".format(count)) |
| 1005 | if count <= 0: |
| 1006 | raise ValueError( |
| 1007 | "count must be a positive integer (got {!r})".format(count)) |
| 1008 | if not isinstance(offset, int): |
| 1009 | raise TypeError( |
| 1010 | "offset must be a non-negative integer (got {!r})".format( |
| 1011 | offset)) |
| 1012 | if offset < 0: |
| 1013 | raise ValueError( |
| 1014 | "offset must be a non-negative integer (got {!r})".format( |
| 1015 | offset)) |
| 1016 | |
| 1017 | async def _connect_sock(self, exceptions, addr_info, local_addr_infos=None): |
| 1018 | """Create, bind and connect one socket.""" |