reqwesthttpsrc/s3: Unlock canceller while waiting for the future to be resolved

Otherwise nothing can ever access the canceller and unlocking does not
work.

meh
This commit is contained in:
Sebastian Dröge 2019-10-01 22:33:43 +03:00
parent 69aefb15f7
commit e90099bad3
2 changed files with 7 additions and 3 deletions

View file

@ -436,6 +436,7 @@ impl ReqwestHttpSrc {
let (sender, receiver) = oneshot::channel::<Bytes>();
canceller.replace(sender);
drop(canceller);
// wrapping timeout around future
let future_timeout = if timeout == 0 {
@ -463,6 +464,7 @@ impl ReqwestHttpSrc {
});
/* Clear out the canceller */
canceller = self.canceller.lock().unwrap();
*canceller = None;
res

View file

@ -20,10 +20,11 @@ where
F: Send + Future<Error = gst::ErrorMessage> + 'static,
F::Item: Send,
{
let mut canceller = canceller.lock().unwrap();
let mut canceller_guard = canceller.lock().unwrap();
let (sender, receiver) = oneshot::channel::<T>();
canceller.replace(sender);
canceller_guard.replace(sender);
drop(canceller_guard);
let unlock_error = gst_error_msg!(gst::ResourceError::Busy, ["unlock"]);
@ -40,7 +41,8 @@ where
});
/* Clear out the canceller */
*canceller = None;
canceller_guard = canceller.lock().unwrap();
*canceller_guard = None;
res
}