diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-07-30 16:26:13 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-08-10 09:39:07 +0300 |
commit | 89346fa945f5660cca6379a9c017b7017266bdb7 (patch) | |
tree | 1b62a2e4ddabf4e27be1e14c09dc5a4c3846f726 /generic | |
parent | 98b618cc9d2b97ddba9b81319e923276e016c78c (diff) |
threadshare/udpsink: Don't hold settings lock while calling into the sink pad handler to clear the clients
Otherwise we can deadlock because of a lock order issue:
- render() is called with the sink pad handler lock and takes the
settings lock
- clearing clients takes the sink pad handler lock
Diffstat (limited to 'generic')
-rw-r--r-- | generic/threadshare/src/udpsink.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/threadshare/src/udpsink.rs b/generic/threadshare/src/udpsink.rs index 0db1a0948..32e9c9895 100644 --- a/generic/threadshare/src/udpsink.rs +++ b/generic/threadshare/src/udpsink.rs @@ -1403,10 +1403,12 @@ impl ObjectImpl for UdpSink { .expect("type checked upstream") .unwrap_or_else(|| "".into()); - let current_client = settings - .host + let host = settings.host.clone(); + let port = settings.port; + + let current_client = host .iter() - .filter_map(|host| try_into_socket_addr(&element, host, settings.port).ok()); + .filter_map(|host| try_into_socket_addr(&element, &host, port).ok()); let clients_iter = current_client.chain(clients.split(',').filter_map(|client| { let rsplit: Vec<&str> = client.rsplitn(2, ':').collect(); @@ -1429,6 +1431,7 @@ impl ObjectImpl for UdpSink { None } })); + drop(settings); self.clear_clients(clients_iter); } |