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 | |
parent | 551f8e643048691b018534b9e4dd055dcd868457 (diff) |
fix for connection failure.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2332 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | libsylph/imap.c | 3 | ||||
-rw-r--r-- | libsylph/socket.c | 17 |
3 files changed, 21 insertions, 7 deletions
@@ -1,3 +1,11 @@ +2009-11-05 + + * libsylph/imap.c: imap_create_tree(): don't continue if connection + failed. + * libsylph/socket.c: don't use alarm() if threads are enabled. + sock_connect_with_timeout(): check with FD_ISSET() when select() + succeeded. + 2009-11-04 * libsylph/socket.c: sock_connect_with_timeout(): use non-blocking diff --git a/libsylph/imap.c b/libsylph/imap.c index d39814c0..50665507 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -2238,7 +2238,8 @@ static gint imap_create_tree(Folder *folder) g_return_val_if_fail(folder->account != NULL, -1); imap_scan_tree(folder); - imap_create_missing_folders(folder); + if (REMOTE_FOLDER(folder)->session) + imap_create_missing_folders(folder); return 0; } 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 |