[gnome-builder/wip/chergert/jsonrpc-gvariant] jsonrpc: cancel read loop on NULL read
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/jsonrpc-gvariant] jsonrpc: cancel read loop on NULL read
- Date: Sat, 18 Mar 2017 08:07:46 +0000 (UTC)
commit a83b7f5fc5993b6aecfd8a643de7cb84ee80d3f0
Author: Christian Hergert <chergert redhat com>
Date: Sat Mar 18 01:07:27 2017 -0700
jsonrpc: cancel read loop on NULL read
contrib/jsonrpc-glib/jsonrpc-input-stream.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/contrib/jsonrpc-glib/jsonrpc-input-stream.c b/contrib/jsonrpc-glib/jsonrpc-input-stream.c
index 1dfa8ef..6649bd1 100644
--- a/contrib/jsonrpc-glib/jsonrpc-input-stream.c
+++ b/contrib/jsonrpc-glib/jsonrpc-input-stream.c
@@ -160,6 +160,7 @@ jsonrpc_input_stream_read_headers_cb (GObject *object,
gsize length = 0;
g_assert (JSONRPC_IS_INPUT_STREAM (self));
+ g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task));
state = g_task_get_task_data (task);
@@ -169,9 +170,13 @@ jsonrpc_input_stream_read_headers_cb (GObject *object,
if (line == NULL)
{
- if (error == NULL)
- goto read_next_line;
- g_task_return_error (task, g_steal_pointer (&error));
+ if (error != NULL)
+ g_task_return_error (task, g_steal_pointer (&error));
+ else
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "No data to read from peer");
return;
}
@@ -248,7 +253,6 @@ jsonrpc_input_stream_read_headers_cb (GObject *object,
return;
}
-read_next_line:
g_data_input_stream_read_line_async (G_DATA_INPUT_STREAM (self),
state->priority,
cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]