-
Notifications
You must be signed in to change notification settings - Fork 331
Description
Hello all,
I am developing a Flask application, served in production by gunicorn
with the eventlet
as worker.
At some point I am using the socket.socket.connect_ex
function that returns an error code, rather than the socket object returned by the connect
function: connect_ex documentation. The connect_ex
returns 0
when the connection is successful.
When I am debugging my application, I run the Werkzeug
WSGI implementation, with the 'regular' socket
from the python library. So far so good.
When I am in production, I greenify the python library with the monkey_patch
, and it replaces the socket object with the eventlet
implementation of the socket. However, the behavior is different from the regular library, because when the connection succeeds, the eventlet
implementation returns None
and breaks my previously functioning code.
This can be seen on the line 277 of the file greenio/.base.py:277
A simple fix that seems to work for me would just to add a return 0
after the call of the function socket_checkerr(fd)
Do you think this is a reasonable patch? Or returning None
is a desired behavior for some shady reason I am not aware of?
Thanks for reading me!