From 56e04b56c394f992bccbd71a38b8aec9c5d0b518 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 26 Aug 2014 09:30:26 +0100 Subject: agent: Split component_free() into component_[close|free]() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closing a component and freeing it are slightly conceptually different. As it happens, freeing it can result in the disposal of the component's NiceIOStream, which requires the agent lock to be released — but closing the rest of the Component requires the agent lock to be held. Splitting the function up simplifies locking handling in other parts of the code (see next commit). --- agent/stream.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'agent/stream.c') diff --git a/agent/stream.c b/agent/stream.c index 75c81c9..ecc333a 100644 --- a/agent/stream.c +++ b/agent/stream.c @@ -66,6 +66,17 @@ stream_new (guint n_components, NiceAgent *agent) return stream; } +void +stream_close (Stream *stream) +{ + GSList *i; + + for (i = stream->components; i; i = i->next) { + Component *component = i->data; + component_close (component); + } +} + void stream_free (Stream *stream) { -- cgit v1.2.1