summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glade-http.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/glade-http.c b/src/glade-http.c
index ebd217fe..3e1a187a 100644
--- a/src/glade-http.c
+++ b/src/glade-http.c
@@ -133,11 +133,12 @@ static void
on_read_ready (GObject *source, GAsyncResult *res, gpointer data)
{
GladeHTTPPrivate *priv = GLADE_HTTP (data)->priv;
+ GError *error = NULL;
gssize bytes_read;
glade_http_emit_status (data, GLADE_HTTP_RECEIVING, NULL);
- bytes_read = g_input_stream_read_finish (G_INPUT_STREAM (source), res, NULL);
+ bytes_read = g_input_stream_read_finish (G_INPUT_STREAM (source), res, &error);
if (bytes_read > 0)
{
@@ -157,8 +158,8 @@ on_read_ready (GObject *source, GAsyncResult *res, gpointer data)
}
else if (bytes_read < 0)
{
- /* Read error */
- g_message ("g_input_stream_read_finish error");
+ glade_http_emit_status (data, GLADE_HTTP_ERROR, error);
+ g_error_free (error);
return;
}
@@ -176,6 +177,11 @@ on_write_ready (GObject *source, GAsyncResult *res, gpointer data)
count = g_output_stream_write_finish (G_OUTPUT_STREAM (source), res, &error);
+ if (error == NULL && priv->data->len != count)
+ error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Error sending data data to %s",
+ priv->host);
+
if (error)
{
glade_http_emit_status (data, GLADE_HTTP_ERROR, error);
@@ -183,12 +189,6 @@ on_write_ready (GObject *source, GAsyncResult *res, gpointer data)
return;
}
- if (priv->data->len != count)
- {
- g_warning ("priv->data_size = %ld, write = %ld", priv->data->len, count);
- return;
- }
-
glade_http_emit_status (data, GLADE_HTTP_WAITING, NULL);
g_input_stream_read_async (g_io_stream_get_input_stream (G_IO_STREAM (priv->connection)),
priv->response_buffer, HTTP_BUFFER_SIZE,