def __init_socket(self, sock: socket) -> int: sock.setblocking(False) sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, self.buffer_size) sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, self.buffer_size) sock_fd = sock.detach() return sock_fd
def _setupsocket(s: socket) -> None: s.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, True) s.setblocking(False)