nonblock => Curl_nonblock, remade the check for a live SSL connection (again)

This commit is contained in:
Daniel Stenberg
2001-10-31 08:44:11 +00:00
parent 64543e09ec
commit b07e2a08f9
3 changed files with 31 additions and 9 deletions

View File

@@ -955,8 +955,27 @@ static bool SocketIsDead(struct connectdata *conn, int sock)
#ifdef USE_SSLEAY
/* the socket seems fine, but is the SSL later fine too? */
if(conn->ssl.use) {
if(SSL_get_shutdown(conn->ssl.handle))
return TRUE; /* this connection is dead! */
int peek;
int error;
Curl_nonblock(sock, TRUE);
peek = SSL_peek(conn->ssl.handle,
conn->data->state.buffer, BUFSIZE);
infof(conn->data, "SSL_peek returned %d\n", peek);
if(-1 == peek) {
error = SSL_get_error(conn->ssl.handle, peek);
infof(conn->data, "SSL_error returned %d\n", error);
if(SSL_ERROR_WANT_READ != error)
ret_val = TRUE;
}
else
/* peek did not return -1 */
ret_val = TRUE;
Curl_nonblock(sock, FALSE);
}
#endif
}