[issue32038] Add API to intercept socket.close()
Yury Selivanov
report at bugs.python.org
Thu Nov 16 12:09:27 EST 2017
Yury Selivanov <yselivanov at gmail.com> added the comment:
> Perhaps you can just dup() the socket? That's what the ref counter is for IIRC.
I already dup them for loop.create_server(sock=sock) and loop.create_connection(sock=sock) cases. Duping for sock_recv & friends will add too much overhead (they are relatively short operations). Another argument against duping is that the number of open FDs is a limited OS resource.
So far Victor's idea of using '_io_refs' sounds like a perfect fit for both asyncio and uvloop. After all, asyncio use case is very similar to `socket.makefile()` -- keep the socket object alive while another API relies on it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32038>
_______________________________________
More information about the Python-bugs-list
mailing list