squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.
MIT License
8.61k stars 581 forks source link

Fixes #122, supported new uvloop(>=0.9.0) #133

Closed ifplusor closed 6 years ago

ifplusor commented 6 years ago

Fixes #122. since uvloop 0.9.0, call TCPTransport.get_extra_info('socket') will return a PseudoSocket(define in python) object instead of socket_socket. and its layer is different than PySocketSockObject, except they (possible) have same interface, of cause fileno().

squeaky-pl commented 6 years ago

Thanks for the work.

You will either need to check uvloop version in code or update setup.py to require version 0.9+, probably requiring newer version is fine.

Did you check reference counting, I think you would need to release references properly at the end of the functions to prevent memory leak.

squeaky-pl commented 6 years ago

You also said that in 0.9.0 no_delay is set by default so if we were to require 0.9+ the whole socket unwrapping process is not needed at all?

ifplusor commented 6 years ago

the bug with reference counting is my mistakes. i don't check uvloop version, i know the setsockopt(with uvloop 0.9.0+) is useless, and this is ugly, but it only cost a system call and compatible old version with less change. today, i think update setup.py to require version 0.9+ is better. i will push a new fixed for all these.