diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2008-02-15 08:40:00 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2008-02-15 08:40:00 +0000 |
commit | 61a5c430f6412e93594d655e4a38ff8a24585797 (patch) | |
tree | 620f202bb982434af825c261d01b8f346d987d2f /libsylph/socket.c | |
parent | a1a045c7a465405af54717703a11877dd67067dc (diff) |
fixed busy loop when connection was immediately refused.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1953 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/socket.c')
-rw-r--r-- | libsylph/socket.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libsylph/socket.c b/libsylph/socket.c index d4540366..9efec203 100644 --- a/libsylph/socket.c +++ b/libsylph/socket.c @@ -922,6 +922,14 @@ static gboolean sock_connect_async_cb(GIOChannel *source, conn_data->channel = NULL; g_io_channel_unref(source); + if (condition & (G_IO_ERR | G_IO_HUP)) { + debug_print("sock_connect_async_cb: condition = %d\n", + condition); + fd_close(fd); + sock_connect_address_list_async(conn_data); + return FALSE; + } + len = sizeof(val); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &val, &len) < 0) { perror("getsockopt"); @@ -1073,10 +1081,13 @@ static gint sock_connect_address_list_async(SockConnectData *conn_data) return -1; } + debug_print("sock_connect_address_list_async: waiting for connect\n"); + conn_data->cur_addr = conn_data->cur_addr->next; conn_data->channel = g_io_channel_unix_new(sock); - conn_data->io_tag = g_io_add_watch(conn_data->channel, G_IO_OUT, + conn_data->io_tag = g_io_add_watch(conn_data->channel, + G_IO_OUT | G_IO_ERR | G_IO_HUP, sock_connect_async_cb, conn_data); return 0; |