aboutsummaryrefslogtreecommitdiff
path: root/libsylph/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/session.c')
-rw-r--r--libsylph/session.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libsylph/session.c b/libsylph/session.c
index d64fc72d..0617e402 100644
--- a/libsylph/session.c
+++ b/libsylph/session.c
@@ -120,7 +120,8 @@ void session_init(Session *session)
gint session_connect(Session *session, const gchar *server, gushort port)
{
#ifndef G_OS_UNIX
- SockInfo *sock;
+ SockInfo *sock = NULL;
+ gint flag = 0;
#endif
g_return_val_if_fail(session != NULL, -1);
g_return_val_if_fail(server != NULL, -1);
@@ -143,8 +144,13 @@ gint session_connect(Session *session, const gchar *server, gushort port)
return 0;
#else
- sock = sock_connect(server, port);
- if (sock == NULL) {
+ session->conn_id = sock_connect_async(server, port);
+ if (session->conn_id < 0) {
+ g_warning("can't connect to server.");
+ session->state = SESSION_ERROR;
+ return -1;
+ }
+ if (sock_connect_async_wait(session->conn_id, &sock) < 0) {
g_warning("can't connect to server.");
session->state = SESSION_ERROR;
return -1;