From 1d512470be3d6b87ccb817e0d71aead0d98f497e Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 19 Apr 2006 11:56:26 +0000 Subject: Minor fixes for the way Windows handles sockets. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@760 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/polypcore/socket-client.c | 15 +++++++++++---- src/polypcore/winsock.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/polypcore/socket-client.c b/src/polypcore/socket-client.c index 7c4f4d6b..734b9dde 100644 --- a/src/polypcore/socket-client.c +++ b/src/polypcore/socket-client.c @@ -151,7 +151,7 @@ static void do_call(pa_socket_client *c) { errno = error; goto finish; } - + io = pa_iochannel_new(c->mainloop, c->fd, c->fd); assert(io); @@ -187,8 +187,13 @@ static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t pa_make_nonblock_fd(c->fd); if ((r = connect(c->fd, sa, len)) < 0) { +#ifdef OS_IS_WIN32 + if (WSAGetLastError() != EWOULDBLOCK) { + pa_log_debug(__FILE__": connect(): %d", WSAGetLastError()); +#else if (errno != EINPROGRESS) { - /*pa_log(__FILE__": connect(): %s", strerror(errno));*/ + pa_log_debug(__FILE__": connect(): %s (%d)", strerror(errno), errno); +#endif return -1; } @@ -473,9 +478,11 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*nam struct hostent *host = NULL; struct sockaddr_in s; - /* FIXME: PF_INET6 support */ - if (hints.ai_family != PF_INET) + /* FIXME: PF_INET6 support */ + if (hints.ai_family == PF_INET6) { + pa_log_error(__FILE__": IPv6 is not supported on Windows"); goto finish; + } host = gethostbyname(a.path_or_host); if (!host) { diff --git a/src/polypcore/winsock.h b/src/polypcore/winsock.h index b1e0f7d4..ae868b38 100644 --- a/src/polypcore/winsock.h +++ b/src/polypcore/winsock.h @@ -13,6 +13,7 @@ #define ETIMEDOUT WSAETIMEDOUT #define ECONNREFUSED WSAECONNREFUSED #define EHOSTUNREACH WSAEHOSTUNREACH +#define EWOULDBLOCK WSAEWOULDBLOCK #endif -- cgit