From 86817b645d57c800affe202bf2308f42e3cf9237 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 30 Sep 2009 04:14:05 +0000 Subject: imap.c: connect in another thread. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2261 ee746299-78ed-0310-b773-934348b2243d --- libsylph/imap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'libsylph/imap.c') 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)) { -- cgit v1.2.3