MCPcopy Create free account
hub / github.com/sshuttle/sshuttle / set_non_blocking_io

Function set_non_blocking_io

sshuttle/helpers.py:276–287  ·  view source on GitHub ↗
(fd)

Source from the content-addressed store, hash-verified

274
275
276def set_non_blocking_io(fd):
277 if sys.platform != "win32":
278 try:
279 os.set_blocking(fd, False)
280 except AttributeError:
281 # python < 3.5
282 flags = fcntl.fcntl(fd, fcntl.F_GETFL)
283 flags |= os.O_NONBLOCK
284 fcntl.fcntl(fd, fcntl.F_SETFL, flags)
285 else:
286 _sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
287 _sock.setblocking(False)
288
289
290class RWPair:

Callers 2

flushMethod · 0.90
fillMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected