Fix handling of receive watch callback within GWeb
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 30 Oct 2010 13:35:19 +0000 (15:35 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 30 Oct 2010 13:35:19 +0000 (15:35 +0200)
gweb/gweb.c

index 48aa24d..3bd2624 100644 (file)
@@ -220,7 +220,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
 
        debug(session->web, "status %u bytes read %zu", status, bytes_read);
 
-       if (bytes_read == 0) {
+       if (status != G_IO_STATUS_NORMAL) {
                session->transport_watch = 0;
                if (session->result_func != NULL)
                        session->result_func(200, NULL, session->result_data);
@@ -266,8 +266,8 @@ static int connect_session_transport(struct web_session *session)
        g_io_channel_set_close_on_unref(session->transport_channel, TRUE);
 
        session->transport_watch = g_io_add_watch(session->transport_channel,
-                                                       G_IO_IN, received_data,
-                                                               session);
+                               G_IO_IN | G_IO_HUP | G_IO_NVAL | G_IO_ERR,
+                                               received_data, session);
 
        return 0;
 }