poorconn.make_socket_patchable

poorconn.make_socket_patchable(s, funcs=(':sending', 'accept'))

Make a socket patchable: Create a PatchableSocket object if any functions in funcs are not patchable. This function is not thread-safe even if s is returned. Please ensure that no other threads are operating on s during the execution of this function.

Parameters
  • s (socket.socket) – The socket to be made patchable.

  • funcs (Iterable[str]) – Create a PatchableSocket object if any functions in it are not patchable. ':sending' means 'send' and 'sendall', and may include any additional sending methods in the future.

Return type

socket.socket