mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
Internal function Curl_select() renamed to Curl_socket_ready()
This commit is contained in:
parent
2166645ce4
commit
fba4cd0e62
3
CHANGES
3
CHANGES
@ -6,6 +6,9 @@
|
||||
|
||||
Changelog
|
||||
|
||||
Yang Tse (20 March 2007)
|
||||
- Internal function Curl_select() renamed to Curl_socket_ready()
|
||||
|
||||
Daniel S (25 March 2007)
|
||||
- Daniel Johnson fixed multi code to traverse the easy handle list properly.
|
||||
A left-over bug from the February 21 fix.
|
||||
|
@ -197,7 +197,7 @@ int waitconnect(curl_socket_t sockfd, /* socket */
|
||||
#endif
|
||||
|
||||
/* now select() until we get connect or timeout */
|
||||
rc = Curl_select(CURL_SOCKET_BAD, sockfd, (int)timeout_msec);
|
||||
rc = Curl_socket_ready(CURL_SOCKET_BAD, sockfd, (int)timeout_msec);
|
||||
if(-1 == rc)
|
||||
/* error, no connect here, try next */
|
||||
return WAITCONN_SELECT_ERROR;
|
||||
|
@ -204,7 +204,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn)
|
||||
Note the typecast here. */
|
||||
timeout_ms = (timeout?(int)timeout:60000);
|
||||
|
||||
switch (Curl_select(sock, CURL_SOCKET_BAD, timeout_ms)) {
|
||||
switch (Curl_socket_ready(sock, CURL_SOCKET_BAD, timeout_ms)) {
|
||||
case -1: /* error */
|
||||
/* let's die here */
|
||||
failf(data, "Error while waiting for server connect");
|
||||
@ -498,7 +498,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
|
||||
if(timeout < interval_ms)
|
||||
interval_ms = timeout;
|
||||
|
||||
switch (Curl_select(sockfd, CURL_SOCKET_BAD, (int)interval_ms)) {
|
||||
switch (Curl_socket_ready(sockfd, CURL_SOCKET_BAD, (int)interval_ms)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
result = CURLE_RECV_ERROR;
|
||||
failf(data, "FTP response aborted due to select() error: %d",
|
||||
@ -2808,7 +2808,7 @@ CURLcode Curl_ftp_multi_statemach(struct connectdata *conn,
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
rc = Curl_select(ftpc->sendleft?CURL_SOCKET_BAD:sock, /* reading */
|
||||
rc = Curl_socket_ready(ftpc->sendleft?CURL_SOCKET_BAD:sock, /* reading */
|
||||
ftpc->sendleft?sock:CURL_SOCKET_BAD, /* writing */
|
||||
0);
|
||||
|
||||
@ -2841,7 +2841,7 @@ static CURLcode ftp_easy_statemach(struct connectdata *conn)
|
||||
return CURLE_OPERATION_TIMEDOUT; /* already too little time */
|
||||
}
|
||||
|
||||
rc = Curl_select(ftpc->sendleft?CURL_SOCKET_BAD:sock, /* reading */
|
||||
rc = Curl_socket_ready(ftpc->sendleft?CURL_SOCKET_BAD:sock, /* reading */
|
||||
ftpc->sendleft?sock:CURL_SOCKET_BAD, /* writing */
|
||||
(int)timeout_ms);
|
||||
|
||||
|
@ -161,7 +161,7 @@ static CURLcode handshake(struct connectdata *conn,
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
}
|
||||
|
||||
rc = Curl_select(conn->sock[sockindex],
|
||||
rc = Curl_socket_ready(conn->sock[sockindex],
|
||||
conn->sock[sockindex], (int)timeout_ms);
|
||||
if(rc > 0)
|
||||
/* reabable or writable, go loop*/
|
||||
@ -535,7 +535,7 @@ int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
|
||||
|
||||
if(conn->ssl[sockindex].session) {
|
||||
while(!done) {
|
||||
int what = Curl_select(conn->sock[sockindex],
|
||||
int what = Curl_socket_ready(conn->sock[sockindex],
|
||||
CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);
|
||||
if(what > 0) {
|
||||
/* Something to read, let's do it and hope that it is the close
|
||||
|
@ -1225,7 +1225,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
||||
|
||||
/* if we're in multi-mode and we would block, return instead for a retry */
|
||||
if (Curl_if_multi == data->state.used_interface) {
|
||||
if (0 == Curl_select(tunnelsocket, CURL_SOCKET_BAD, 0))
|
||||
if (0 == Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD, 0))
|
||||
/* return so we'll be called again polling-style */
|
||||
return CURLE_OK;
|
||||
else {
|
||||
@ -1273,7 +1273,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
||||
}
|
||||
|
||||
/* loop every second at least, less if the timeout is near */
|
||||
switch (Curl_select(tunnelsocket, CURL_SOCKET_BAD,
|
||||
switch (Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD,
|
||||
check<1000L?(int)check:1000)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
error = SELECT_ERROR;
|
||||
|
@ -84,8 +84,8 @@
|
||||
|
||||
/*
|
||||
* Internal function used for waiting a specific amount of ms
|
||||
* in Curl_select() and Curl_poll() when no file descriptor is
|
||||
* provided to wait on, just being used to delay execution.
|
||||
* in Curl_socket_ready() and Curl_poll() when no file descriptor
|
||||
* is provided to wait on, just being used to delay execution.
|
||||
* WinSock select() and poll() timeout mechanisms need a valid
|
||||
* socket descriptor in a not null file descriptor set to work.
|
||||
* Waiting indefinitely with this function is not allowed, a
|
||||
@ -160,7 +160,7 @@ static int wait_ms(int timeout_ms)
|
||||
* 0 = timeout
|
||||
* CSELECT_IN | CSELECT_OUT | CSELECT_ERR
|
||||
*/
|
||||
int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
|
||||
int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
|
||||
{
|
||||
#ifdef HAVE_POLL_FINE
|
||||
struct pollfd pfd[2];
|
||||
|
@ -68,7 +68,7 @@ struct pollfd
|
||||
#define CSELECT_OUT 0x02
|
||||
#define CSELECT_ERR 0x04
|
||||
|
||||
int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms);
|
||||
int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms);
|
||||
|
||||
int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
|
||||
|
||||
|
@ -83,7 +83,7 @@ static int blockread_all(struct connectdata *conn, /* connection data */
|
||||
result = ~CURLE_OK;
|
||||
break;
|
||||
}
|
||||
if(Curl_select(sockfd, CURL_SOCKET_BAD,
|
||||
if(Curl_socket_ready(sockfd, CURL_SOCKET_BAD,
|
||||
(int)(conn_timeout - conntime)) <= 0) {
|
||||
result = ~CURLE_OK;
|
||||
break;
|
||||
@ -372,7 +372,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||
Curl_nonblock(sock, TRUE);
|
||||
|
||||
/* wait until socket gets connected */
|
||||
result = Curl_select(CURL_SOCKET_BAD, sock, (int)timeout);
|
||||
result = Curl_socket_ready(CURL_SOCKET_BAD, sock, (int)timeout);
|
||||
|
||||
if(-1 == result) {
|
||||
failf(conn->data, "SOCKS5: no connection here");
|
||||
@ -404,7 +404,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||
|
||||
Curl_nonblock(sock, TRUE);
|
||||
|
||||
result = Curl_select(sock, CURL_SOCKET_BAD, (int)timeout);
|
||||
result = Curl_socket_ready(sock, CURL_SOCKET_BAD, (int)timeout);
|
||||
|
||||
if(-1 == result) {
|
||||
failf(conn->data, "SOCKS5 nothing to read");
|
||||
|
@ -751,7 +751,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
|
||||
|
||||
if(connssl->handle) {
|
||||
while(!done) {
|
||||
int what = Curl_select(conn->sock[sockindex],
|
||||
int what = Curl_socket_ready(conn->sock[sockindex],
|
||||
CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);
|
||||
if(what > 0) {
|
||||
/* Something to read, let's do it and hope that it is the close
|
||||
@ -1728,7 +1728,7 @@ Curl_ossl_connect_common(struct connectdata *conn,
|
||||
connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
|
||||
|
||||
while(1) {
|
||||
int what = Curl_select(readfd, writefd, nonblocking?0:(int)timeout_ms);
|
||||
int what = Curl_socket_ready(readfd, writefd, nonblocking?0:(int)timeout_ms);
|
||||
if(what > 0)
|
||||
/* readable or writable, go loop in the outer loop */
|
||||
break;
|
||||
|
@ -678,7 +678,7 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
tftp_state_machine(state, event) ) {
|
||||
|
||||
/* Wait until ready to read or timeout occurs */
|
||||
rc=Curl_select(state->sockfd, CURL_SOCKET_BAD, state->retry_time * 1000);
|
||||
rc=Curl_socket_ready(state->sockfd, CURL_SOCKET_BAD, state->retry_time * 1000);
|
||||
|
||||
if(rc == -1) {
|
||||
/* bail out */
|
||||
|
@ -329,7 +329,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
else
|
||||
fd_write = CURL_SOCKET_BAD;
|
||||
|
||||
select_res = Curl_select(fd_read, fd_write, 0);
|
||||
select_res = Curl_socket_ready(fd_read, fd_write, 0);
|
||||
if(select_res == CSELECT_ERR) {
|
||||
failf(data, "select/poll returned error");
|
||||
return CURLE_SEND_ERROR;
|
||||
@ -1828,7 +1828,7 @@ Transfer(struct connectdata *conn)
|
||||
the timeout case and if we limit transfer speed we must make sure that
|
||||
this function doesn't transfer anything while in HOLD status. */
|
||||
|
||||
switch (Curl_select(fd_read, fd_write, 1000)) {
|
||||
switch (Curl_socket_ready(fd_read, fd_write, 1000)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
#ifdef EINTR
|
||||
/* The EINTR is not serious, and it seems you might get this more
|
||||
|
Loading…
Reference in New Issue
Block a user