moved the SSL pending function to the proper place and name

This commit is contained in:
Daniel Stenberg 2007-01-24 17:19:08 +00:00
parent 45bac25d90
commit 3239f059b8
3 changed files with 18 additions and 11 deletions

View File

@ -600,3 +600,16 @@ int Curl_ssl_check_cxn(struct connectdata *conn)
return -1; /* connection status unknown */ return -1; /* connection status unknown */
#endif /* USE_SSLEAY */ #endif /* USE_SSLEAY */
} }
bool Curl_ssl_data_pending(struct connectdata *conn,
int connindex)
{
#ifdef USE_SSLEAY
/* OpenSSL-specific */
if(conn->ssl[connindex].handle)
/* SSL is in use */
return SSL_pending(conn->ssl[connindex].handle);
#endif
return FALSE; /* nothing pending */
}

View File

@ -71,9 +71,13 @@ int Curl_ssl_check_cxn(struct connectdata *conn);
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex); CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
bool Curl_ssl_data_pending(struct connectdata *conn,
int connindex);
#if !defined(USE_SSL) && !defined(SSLGEN_C) #if !defined(USE_SSL) && !defined(SSLGEN_C)
/* set up blank macros for none-SSL builds */ /* set up blank macros for none-SSL builds */
#define Curl_ssl_close_all(x) #define Curl_ssl_close_all(x)
#define Curl_ssl_data_pending(x) 0
#endif #endif
#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */

View File

@ -273,20 +273,10 @@ CURLcode Curl_readrewind(struct connectdata *conn)
return CURLE_OK; return CURLE_OK;
} }
#ifdef USE_SSLEAY
/* FIX: this is nasty OpenSSL-specific code that really shouldn't be here */
static int data_pending(struct connectdata *conn) static int data_pending(struct connectdata *conn)
{ {
if(conn->ssl[FIRSTSOCKET].handle) return Curl_ssl_data_pending(conn, FIRSTSOCKET);
/* SSL is in use */
return SSL_pending(conn->ssl[FIRSTSOCKET].handle);
return 0; /* nothing */
} }
#else
/* non-SSL never have pending data */
#define data_pending(x) 0
#endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) (a < b ? a : b) #define MIN(a,b) (a < b ? a : b)