Public feed #378179

Something

public text v1 · immutable
Raw Edit
·published 2007-03-02 09:43 UTC
rendered paste body
[arekm@tarm ~/.SVN-OTHER/python-svn/release25-maint]$ svn diff Modules/_ssl.c
Index: Modules/_ssl.c
===================================================================
--- Modules/_ssl.c      (wersja 53397)
+++ Modules/_ssl.c      (kopia robocza)
@@ -367,7 +367,7 @@
 {
        fd_set fds;
        struct timeval tv;
-       int rc;
+       int rc, shutdown_state;

        /* Nothing to do unless we're in timeout mode (not non-blocking) */
        if (s->sock_timeout < 0.0)
@@ -379,6 +379,12 @@
        if (s->sock_fd < 0)
                return SOCKET_HAS_BEEN_CLOSED;

+       shutdown_state = SSL_set_shutdown(self->ssl);
+       if (shutdown_state & SSL_SENT_SHUTDOWN && writing)
+               return SOCKET_HAS_BEEN_CLOSED;
+       else if (shutdown_state & SSL_RECEIVED_SHUTDOWN && !writing)
+               return SOCKET_HAS_BEEN_CLOSED;
+
        /* Prefer poll, if available, since you can poll() any fd
         * which can't be done with select(). */
 #ifdef HAVE_POLL