summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-11-19 11:10:37 +0100
committerCarlos Garnacho <carlosg@gnome.org>2022-11-19 14:02:46 +0100
commit478034b3e384069c6073180d3537cb41bfe90b3c (patch)
tree453d26a64fa94e6d1f1ed5459d7708b617368388
parent8e82b74241f9172a47122368d1c4533613ff216c (diff)
downloadtracker-478034b3e384069c6073180d3537cb41bfe90b3c.tar.gz
libtracker-sparql: Close descriptors asynchronously in TrackerEndpointDBus
The QueryRequest and UpdateRequest internal data structures may be freed from the thread that is handling endpoint requests. Avoid closing descriptors from that thread, this is esp. important with the write FDs since there might be data pending to be written and flushed, so it may be a time consuming operation, or it may even stall if the peer is busy with other things. Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/386
-rw-r--r--src/libtracker-sparql/tracker-endpoint-dbus.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c
index 4bc486c76..858448c7f 100644
--- a/src/libtracker-sparql/tracker-endpoint-dbus.c
+++ b/src/libtracker-sparql/tracker-endpoint-dbus.c
@@ -269,8 +269,9 @@ query_request_free (QueryRequest *request)
g_source_unref (request->source);
g_object_unref (request->cancellable);
- g_output_stream_close (G_OUTPUT_STREAM (request->data_stream),
- NULL, NULL);
+ g_output_stream_close_async (G_OUTPUT_STREAM (request->data_stream),
+ G_PRIORITY_DEFAULT,
+ NULL, NULL, NULL);
g_object_unref (request->invocation);
g_object_unref (request->data_stream);
@@ -346,8 +347,9 @@ update_request_read_next (UpdateRequest *request,
static void
update_request_free (UpdateRequest *request)
{
- g_input_stream_close (G_INPUT_STREAM (request->input_stream),
- NULL, NULL);
+ g_input_stream_close_async (G_INPUT_STREAM (request->input_stream),
+ G_PRIORITY_DEFAULT,
+ NULL, NULL, NULL);
g_ptr_array_unref (request->queries);
g_object_unref (request->invocation);