diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-11-05 05:48:43 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-11-05 05:48:43 +0000 |
commit | 4de2e90acfe9a16a7fdd48e1fe74fbc628a1662b (patch) | |
tree | 76879fe6f6ba388c95f408d0da204cf3de9c9755 /libsylph/socket.c | |
parent | 551f8e643048691b018534b9e4dd055dcd868457 (diff) |
fix for connection failure.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2332 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/socket.c')
-rw-r--r-- | libsylph/socket.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libsylph/socket.c b/libsylph/socket.c index 93686dca..f28c8136 100644 --- a/libsylph/socket.c +++ b/libsylph/socket.c @@ -624,7 +624,7 @@ static gint fd_check_io(gint fd, GIOCondition cond) } } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(USE_THREADS) static sigjmp_buf jmpenv; static void timeout_handler(gint sig) @@ -663,11 +663,16 @@ static gint sock_connect_with_timeout(gint sock, perror("sock_connect_with_timeout: select"); return -1; } else if (ret == 0) { + debug_print("sock_connect_with_timeout: timeout\n"); errno = ETIMEDOUT; return -1; } else { - g_print("conn ok\n"); - ret = 0; + if (FD_ISSET(sock, &fds)) { + ret = 0; + } else { + debug_print("sock_connect_with_timeout: fd not set\n"); + return -1; + } } } else { perror("sock_connect_with_timeout: connect"); @@ -699,7 +704,7 @@ static void resolver_init(void) struct hostent *my_gethostbyname(const gchar *hostname) { struct hostent *hp; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(USE_THREADS) void (*prev_handler)(gint); alarm(0); @@ -715,7 +720,7 @@ struct hostent *my_gethostbyname(const gchar *hostname) #endif if ((hp = gethostbyname(hostname)) == NULL) { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(USE_THREADS) alarm(0); signal(SIGALRM, prev_handler); #endif @@ -724,7 +729,7 @@ struct hostent *my_gethostbyname(const gchar *hostname) return NULL; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(USE_THREADS) alarm(0); signal(SIGALRM, prev_handler); #endif |