mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 18:51:11 +00:00
server: use signal to keep track of clients
Keep track of all the clients that the server creates and remove them when they fire the 'closed' signal.
This commit is contained in:
parent
4a4a15077b
commit
318b3a1df4
1 changed files with 17 additions and 3 deletions
|
@ -623,16 +623,30 @@ close_error:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unmanage_client (GstRTSPClient * client, GstRTSPServer * server)
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (server, "unmanage client %p", client);
|
||||||
|
|
||||||
|
g_mutex_lock (server->lock);
|
||||||
|
server->clients = g_list_remove (server->clients, client);
|
||||||
|
g_mutex_unlock (server->lock);
|
||||||
|
|
||||||
|
g_object_unref (client);
|
||||||
|
}
|
||||||
|
|
||||||
/* add the client to the active list of clients, takes ownership of
|
/* add the client to the active list of clients, takes ownership of
|
||||||
* the client */
|
* the client */
|
||||||
static void
|
static void
|
||||||
manage_client (GstRTSPServer * server, GstRTSPClient * client)
|
manage_client (GstRTSPServer * server, GstRTSPClient * client)
|
||||||
{
|
{
|
||||||
|
GST_DEBUG_OBJECT (server, "manage client %p", client);
|
||||||
gst_rtsp_client_set_server (client, server);
|
gst_rtsp_client_set_server (client, server);
|
||||||
|
|
||||||
/* can unref the client now, when the request is finished, it will be
|
g_mutex_lock (server->lock);
|
||||||
* unreffed async. */
|
g_signal_connect (client, "closed", (GCallback) unmanage_client, server);
|
||||||
gst_object_unref (client);
|
server->clients = g_list_prepend (server->clients, client);
|
||||||
|
g_mutex_unlock (server->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstRTSPClient *
|
static GstRTSPClient *
|
||||||
|
|
Loading…
Reference in a new issue