mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Major overhaul of timeout sockets:
- setblocking(0) and settimeout(0) are now equivalent, and ditto for setblocking(1) and settimeout(None). - Don't raise an exception from internal_select(); let the final call report the error (this means you will get an EAGAIN error instead of an ETIMEDOUT error -- I don't care). - Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets, so other theads can run (this was a bug in the original code). - Redid the retry logic in connect() and connect_ex() to avoid masking errors. This probably doesn't work for Windows yet; I'll fix that next. It may also fail on other platforms, depending on what retrying a connect does; I need help with this. - Get rid of the retry logic in accept(). I don't think it was needed at all. But I may be wrong.
This commit is contained in:
parent
dfad1a9039
commit
11ba094957
5 changed files with 89 additions and 247 deletions
|
@ -83,9 +83,8 @@ typedef struct {
|
|||
PyObject *(*errorhandler)(void); /* Error handler; checks
|
||||
errno, returns NULL and
|
||||
sets a Python exception */
|
||||
int sock_blocking; /* Flag indicated whether the
|
||||
socket is in blocking mode */
|
||||
double sock_timeout; /* Operation timeout value */
|
||||
double sock_timeout; /* Operation timeout in seconds;
|
||||
0.0 means non-blocking */
|
||||
} PySocketSockObject;
|
||||
|
||||
/* --- C API ----------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue