Skip to content
Snippets Groups Projects
Commit b3ce9d49 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

non-blocking connect needs special handling under Winsock.

parent b67eb8e2
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,8 @@
# define AC_SOCKET_INVALID ((unsigned int) ~0)
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#define ETIMEDOUT WSAETIMEDOUT
#elif MACOS
# define tcp_close( s ) tcpclose( s )
......
......@@ -102,7 +102,7 @@ ldap_pvt_ndelay_on(LDAP *ld, int fd)
#else
{
ioctl_t status = 1;
return ioctl( fd, FIONBIO, (caddr_t)&status );
return ioctl( fd, FIONBIO, &status );
}
#endif
return 0;
......@@ -118,7 +118,7 @@ ldap_pvt_ndelay_off(LDAP *ld, int fd)
#else
{
ioctl_t status = 0;
return ioctl( fd, FIONBIO, (caddr_t)&status );
return ioctl( fd, FIONBIO, &status );
}
#endif
}
......@@ -146,7 +146,7 @@ ldap_pvt_prepare_socket(LDAP *ld, int fd)
#ifdef TCP_NODELAY
{
int dummy = 1;
if ( setsockopt(fd,IPPROTO_TCP,TCP_NODELAY,&dummy,sizeof(dummy)) == -1 )
if ( setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (char*) &dummy, sizeof(dummy) ) == -1 )
return -1;
}
#endif
......@@ -206,7 +206,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
}
static int
ldap_pvt_connect(LDAP *ld, int s, struct sockaddr_in *sin, int async)
ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_in *sin, int async)
{
struct timeval tv, *opt_tv=NULL;
fd_set wfds, *z=NULL;
......@@ -233,14 +233,16 @@ ldap_pvt_connect(LDAP *ld, int s, struct sockaddr_in *sin, int async)
ldap_pvt_set_errno( WSAGetLastError() );
#endif
if ( (errno != EINPROGRESS) && (errno != EWOULDBLOCK) )
if ( errno != EINPROGRESS && errno != EWOULDBLOCK ) {
return ( -1 );
}
#ifdef notyet
if ( async ) return ( -2 );
#endif
FD_ZERO(&wfds); FD_SET(s, &wfds );
FD_ZERO(&wfds);
FD_SET(s, &wfds );
if ( select(s + 1, z, &wfds, z, opt_tv ? &tv : NULL) == -1)
return ( -1 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment