aboutsummaryrefslogtreecommitdiff
path: root/libsylph/imap.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-09-30 04:14:05 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-09-30 04:14:05 +0000
commit86817b645d57c800affe202bf2308f42e3cf9237 (patch)
treeaa6f91fec53cf03da081b03c593b20cbda92dbee /libsylph/imap.c
parent8674dc3a543cfcc99af9061c36bf86f387be526a (diff)
imap.c: connect in another thread.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2261 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/imap.c')
-rw-r--r--libsylph/imap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c
index 10f9a273..3e554740 100644
--- a/libsylph/imap.c
+++ b/libsylph/imap.c
@@ -2743,13 +2743,23 @@ static SockInfo *imap_open(const gchar *server, gushort port,
static SockInfo *imap_open(const gchar *server, gushort port)
#endif
{
- SockInfo *sock;
+ SockInfo *sock = NULL;
+#if USE_THREADS
+ gint conn_id;
+ if ((conn_id = sock_connect_async_thread(server, port)) < 0 ||
+ sock_connect_async_thread_wait(conn_id, &sock) < 0) {
+ log_warning(_("Can't connect to IMAP4 server: %s:%d\n"),
+ server, port);
+ return NULL;
+ }
+#else
if ((sock = sock_connect(server, port)) == NULL) {
log_warning(_("Can't connect to IMAP4 server: %s:%d\n"),
server, port);
return NULL;
}
+#endif
#if USE_SSL
if (ssl_type == SSL_TUNNEL && !ssl_init_socket(sock)) {