• Zebediah Figura's avatar
    ws2_32: Do not use SHUT_RD. · 416072a8
    Zebediah Figura authored
    Win32 SD_RECEIVE has the following effects on a TCP or UDP socket:
    
    * further calls to recv() et al. fail with ESHUTDOWN. However, Linux and Mac
      instead return 0.
    
    * currently pending calls to recv() are not affected. However, Linux and Mac
      cause them to return 0.
    
    * calls to WSAPoll() are unaffected. However, Linux and Mac instead signal
      both POLLHUP and POLLIN.
    
    * for TCP connections, further data sent by the peer causes the connection to be
      reset. Mac and BSD will silently drop data, and Linux simply queues it
      forever.
    
    In short, SHUT_RD does nothing that we want it to do on Linux or Mac (and
    probably also BSD, though I am unable to test this).
    
    Most of this impedance mismatch can be worked around in Wine, except for
    WSAPoll(). Since poll() will always return POLLHUP, we can't safely ask for
    POLLOUT, which we may need to do. Hence, since we aren't getting any benefit
    from SHUT_RD, don't use it.
    
    Note that this doesn't actually fix any tests, since we have some rather bizarre
    logic to defer shutdown anyway (for an asynchronous socket, we don't call
    shutdown(SHUT_RD) until the peer sends data; this is probably an unintended bug,
    but "fixing" it ends up causing test failures, which is the main impetus for
    this patch.)
    Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    416072a8
socket.c 205 KB