diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2022-10-22 22:51:34 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2022-10-23 13:46:25 +0200 |
commit | 9b331935782214c7c46b26ee6916d3d423aa8116 (patch) | |
tree | d2aab192205e211ba924df90f711b68bc2727646 | |
parent | 6d5268955c9a7bda432c022f92060c5d30443c21 (diff) | |
download | tracker-9b331935782214c7c46b26ee6916d3d423aa8116.tar.gz |
libtracker-sparql: Pass cancellable to D-Bus cursor writing operations
If cancellation happens while the D-Bus endpoint is writing cursor contents
for a D-Bus TrackerSparqlConnection client, we do not much in the way to
stopping the FD writing operation from happening.
This however also means the FD was closed by the other end, so they will
fail anyway with an "Interrupted" error when writes start to fail. Make
all things depend on the same cancellable, so the error is consistently
G_IO_ERROR_CANCELLED and we bail out as soon as possible.
-rw-r--r-- | src/libtracker-sparql/tracker-endpoint-dbus.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c index 5a0d4849f..4bc486c76 100644 --- a/src/libtracker-sparql/tracker-endpoint-dbus.c +++ b/src/libtracker-sparql/tracker-endpoint-dbus.c @@ -374,7 +374,8 @@ write_cursor (QueryRequest *request, glong cur_offset = -1; if (!g_data_output_stream_put_int32 (request->data_stream, n_columns, - NULL, &inner_error)) + request->cancellable, + &inner_error)) break; for (i = 0; i < n_columns; i++) { @@ -382,7 +383,8 @@ write_cursor (QueryRequest *request, if (!g_data_output_stream_put_int32 (request->data_stream, tracker_sparql_cursor_get_value_type (cursor, i), - NULL, &inner_error)) + request->cancellable, + &inner_error)) goto out; values[i] = tracker_sparql_cursor_get_string (cursor, i, &len); @@ -393,17 +395,21 @@ write_cursor (QueryRequest *request, for (i = 0; i < n_columns; i++) { if (!g_data_output_stream_put_int32 (request->data_stream, - offsets[i], NULL, &inner_error)) + offsets[i], + request->cancellable, + &inner_error)) goto out; } for (i = 0; i < n_columns; i++) { if (!g_data_output_stream_put_string (request->data_stream, values[i] ? values[i] : "", - NULL, &inner_error)) + request->cancellable, + &inner_error)) goto out; - if (!g_data_output_stream_put_byte (request->data_stream, 0, NULL, + if (!g_data_output_stream_put_byte (request->data_stream, 0, + request->cancellable, &inner_error)) goto out; } |