diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | libsylph/socket.c | 13 |
3 files changed, 26 insertions, 1 deletions
@@ -1,5 +1,12 @@ 2008-02-15 + * libsylph/socket.c: + sock_connect_async_cb() + sock_connect_address_list_async(): also watch for G_IO_ERR and + G_IO_HUP (fixes busy loop when connection is immediately refused). + +2008-02-15 + * libsylph/ssl.c src/sslmanager.c: added the feature to save SSL peer certificate and always accept it. diff --git a/ChangeLog.ja b/ChangeLog.ja index c4abc19f..cfa95a07 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2008-02-15 + * libsylph/socket.c: + sock_connect_async_cb() + sock_connect_address_list_async(): G_IO_ERR と G_IO_HUP も見る + ようにした(接続が即座に拒否された場合ビジーループになるのを修正)。 + +2008-02-15 + * libsylph/ssl.c src/sslmanager.c: SSL 証明書を保存し、常に受け入れる機能を追加。 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; |