2 This patch should fix the spurious connection drops that fail jobs
3 as reported in bug #888.
4 Apply it to version 2.0.3 (possibly earlier versions of 2.0) with:
7 patch -p0 <2.0.3-tls-disconnect.patch
13 ===================================================================
14 --- src/lib/tls.c (revision 4668)
15 +++ src/lib/tls.c (working copy)
17 * The first time to initiate the shutdown handshake, and the second to
18 * receive the peer's reply.
20 - * However, it is valid to close the SSL connection after the initial
21 - * shutdown notification is sent to the peer, without waiting for the
22 - * peer's reply, as long as you do not plan to re-use that particular
23 - * SSL connection object.
25 - * Because we do not re-use SSL connection objects, I do not bother
26 - * calling SSL_shutdown a second time.
28 * In addition, if the underlying socket is blocking, SSL_shutdown()
29 * will not return until the current stage of the shutdown process has
30 * completed or an error has occured. By setting the socket blocking
32 flags = bnet_set_blocking(bsock);
34 err = SSL_shutdown(bsock->tls->openssl);
36 + /* Finish up the closing */
37 + err = SSL_shutdown(bsock->tls->openssl);
40 switch (SSL_get_error(bsock->tls->openssl, err)) {
46 - /* Restore saved flags */
47 - bnet_restore_blocking(bsock, flags);
50 /* Does all the manual labor for tls_bsock_readn() and tls_bsock_writen() */