aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-03-26 23:23:46 +0000
committerYang Tse <yangsita@gmail.com>2007-03-26 23:23:46 +0000
commitfba4cd0e625cdba3561b3530317ba87ae348aeaf (patch)
tree0b245f00a4f21478d863db7cdd49a92797ee8cf9
parent2166645ce4091b14ef6fd25c594d184c4f700ba5 (diff)
Internal function Curl_select() renamed to Curl_socket_ready()
-rw-r--r--CHANGES3
-rw-r--r--lib/connect.c2
-rw-r--r--lib/ftp.c8
-rw-r--r--lib/gtls.c4
-rw-r--r--lib/http.c4
-rw-r--r--lib/select.c6
-rw-r--r--lib/select.h2
-rw-r--r--lib/socks.c6
-rw-r--r--lib/ssluse.c4
-rw-r--r--lib/tftp.c2
-rw-r--r--lib/transfer.c4
-rw-r--r--lib/url.c2
12 files changed, 25 insertions, 22 deletions
diff --git a/CHANGES b/CHANGES
index 58009ebfd..13668750f 100644
--- a/CHANGES
+++ b/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.
diff --git a/lib/connect.c b/lib/connect.c
index 147b73eaa..95791cf5d 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -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;
diff --git a/lib/ftp.c b/lib/ftp.c
index 51bd16411..39491b1bb 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -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);
diff --git a/lib/gtls.c b/lib/gtls.c
index 3413a0709..3393a34ff 100644
--- a/lib/gtls.c
+++ b/lib/gtls.c
@@ -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
diff --git a/lib/http.c b/lib/http.c
index b4a62f496..94d2cc00c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -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;
diff --git a/lib/select.c b/lib/select.c
index 4e6c3046d..27f85fac8 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -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];
diff --git a/lib/select.h b/lib/select.h
index c5a9c1059..8c59f155e 100644
--- a/lib/select.h
+++ b/lib/select.h
@@ -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);
diff --git a/lib/socks.c b/lib/socks.c
index d6c29e52e..852245074 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -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");
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 593f23857..dca894770 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -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;
diff --git a/lib/tftp.c b/lib/tftp.c
index bc17974ad..ed631fad8 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -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 */
diff --git a/lib/transfer.c b/lib/transfer.c
index 8e6f5e19f..74d6b78b9 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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
diff --git a/lib/url.c b/lib/url.c
index a83707dac..43853f367 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1890,7 +1890,7 @@ static bool SocketIsDead(curl_socket_t sock)
int sval;
bool ret_val = TRUE;
- sval = Curl_select(sock, CURL_SOCKET_BAD, 0);
+ sval = Curl_socket_ready(sock, CURL_SOCKET_BAD, 0);
if(sval == 0)
/* timeout */
ret_val = FALSE;