• P
    unix/modusocket: Finish socket.settimeout() implementation. · 0c18633e
    Paul Sokolovsky 提交于
    1. Return correct error code for non-blocking vs timed out socket
    (POSIX returns EAGAIN for both, we want ETIMEDOUT in case of timed
    out socket). To achieve this, blocking/non-blocking flag is added
    to the mp_obj_socket_t, to avoid issuing fcntl() syscall each time
    EAGAIN occurs. (mp_obj_socket_t used to be 8 bytes, having some room
    in a standard 16-byte alloc block.)
    
    2. Handle socket.settimeout(0) properly - in Python, that means
    non-blocking mode, but SO_RCVTIMEO/SO_SNDTIMEO of 0 is infinite
    timeout.
    
    3. Overall, make sure that socket.settimeout() call switches blocking
    state as expected.
    0c18633e
modusocket.c 22.6 KB