summaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-07-09 21:47:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-07-09 21:47:24 +0000
commitd709cb2ae37c9d9512fe3a9724dd95b0fe49d108 (patch)
treed68c12351c40178ee635c4aa25679f4af44627c8 /lib/connect.c
parent444bb03fab4ffd0149d1e4479e24fb038388a6fd (diff)
downloadcurl-d709cb2ae37c9d9512fe3a9724dd95b0fe49d108.tar.gz
- Eric Wong introduced curlx_nonblock() that the curl tool now (re-)uses for
setting a file descriptor non-blocking. Used by the functionality Eric himself brough on June 15th.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 49914e82f..7865216bd 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -177,59 +177,6 @@ long Curl_timeleft(struct connectdata *conn,
return timeout_ms;
}
-
-/*
- * Curl_nonblock() set the given socket to either blocking or non-blocking
- * mode based on the 'nonblock' boolean argument. This function is highly
- * portable.
- */
-int Curl_nonblock(curl_socket_t sockfd, /* operate on this */
- int nonblock /* TRUE or FALSE */)
-{
-#if defined(USE_BLOCKING_SOCKETS)
-
- return 0; /* returns success */
-
-#elif defined(HAVE_FCNTL_O_NONBLOCK)
-
- /* most recent unix versions */
- int flags;
- flags = fcntl(sockfd, F_GETFL, 0);
- if(FALSE != nonblock)
- return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
- else
- return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
-
-#elif defined(HAVE_IOCTL_FIONBIO)
-
- /* older unix versions */
- int flags;
- flags = nonblock;
- return ioctl(sockfd, FIONBIO, &flags);
-
-#elif defined(HAVE_IOCTLSOCKET_FIONBIO)
-
- /* Windows */
- unsigned long flags;
- flags = nonblock;
- return ioctlsocket(sockfd, FIONBIO, &flags);
-
-#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
-
- /* Amiga */
- return IoctlSocket(sockfd, FIONBIO, (long)nonblock);
-
-#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
-
- /* BeOS */
- long b = nonblock ? 1 : 0;
- return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
-
-#else
-# error "no non-blocking method was found/used/set"
-#endif
-}
-
/*
* waitconnect() waits for a TCP connect on the given socket for the specified
* number if milliseconds. It returns:
@@ -846,7 +793,7 @@ singleipconnect(struct connectdata *conn,
}
/* set socket non-blocking */
- Curl_nonblock(sockfd, TRUE);
+ curlx_nonblock(sockfd, TRUE);
/* Connect TCP sockets, bind UDP */
if(conn->socktype == SOCK_STREAM)