mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
New code for BeOS-style non-blocking sockets, provided by Shard and
Jeremy Friesner.
This commit is contained in:
parent
0bbe184f1f
commit
57b6202eaa
@ -103,6 +103,7 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
{
|
{
|
||||||
#undef SETBLOCK
|
#undef SETBLOCK
|
||||||
#ifdef HAVE_O_NONBLOCK
|
#ifdef HAVE_O_NONBLOCK
|
||||||
|
/* most recent unix versions */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = fcntl(socket, F_GETFL, 0);
|
flags = fcntl(socket, F_GETFL, 0);
|
||||||
@ -114,6 +115,7 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FIONBIO
|
#ifdef HAVE_FIONBIO
|
||||||
|
/* older unix versions */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = nonblock;
|
flags = nonblock;
|
||||||
@ -122,6 +124,7 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IOCTLSOCKET
|
#ifdef HAVE_IOCTLSOCKET
|
||||||
|
/* Windows? */
|
||||||
int flags;
|
int flags;
|
||||||
flags = nonblock;
|
flags = nonblock;
|
||||||
return ioctlsocket(socket, FIONBIO, &flags);
|
return ioctlsocket(socket, FIONBIO, &flags);
|
||||||
@ -129,13 +132,21 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IOCTLSOCKET_CASE
|
#ifdef HAVE_IOCTLSOCKET_CASE
|
||||||
|
/* presumably for Amiga */
|
||||||
return IoctlSocket(socket, FIONBIO, (long)nonblock);
|
return IoctlSocket(socket, FIONBIO, (long)nonblock);
|
||||||
#define SETBLOCK 4
|
#define SETBLOCK 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SO_NONBLOCK
|
||||||
|
/* BeOS */
|
||||||
|
long b = nonblock ? 1 : 0;
|
||||||
|
return setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
|
||||||
|
#define SETBLOCK 5
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DISABLED_NONBLOCKING
|
#ifdef HAVE_DISABLED_NONBLOCKING
|
||||||
return 0; /* returns success */
|
return 0; /* returns success */
|
||||||
#define SETBLOCK 5
|
#define SETBLOCK 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SETBLOCK
|
#ifndef SETBLOCK
|
||||||
@ -348,11 +359,11 @@ int socketerror(int sockfd)
|
|||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
socklen_t errSize = sizeof(err);
|
socklen_t errSize = sizeof(err);
|
||||||
|
#ifdef SO_ERROR
|
||||||
if( -1 == getsockopt(sockfd, SOL_SOCKET, SO_ERROR,
|
if( -1 == getsockopt(sockfd, SOL_SOCKET, SO_ERROR,
|
||||||
(void *)&err, &errSize))
|
(void *)&err, &errSize))
|
||||||
err = Curl_ourerrno();
|
err = Curl_ourerrno();
|
||||||
|
#endif
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user