From e9456945d92ad805075bdd1ed7f871910a7c2111 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 16 Jul 2023 14:18:42 -0500 Subject: [PATCH] If set is empty don't select on it --- src/upload.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/upload.rs b/src/upload.rs index 3b3b540..bf81086 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -357,8 +357,26 @@ where break 'outer; } + if set.is_empty() { + if let Some(res) = m.next().await { + match res { + Ok(field) => { + set.spawn_local(handle_stream_field(field, Rc::clone(&form))); + } + Err(e) => { + error = Some(e.into()); + continue 'outer; + } + } + } else { + stream_finished = true; + continue 'outer; + } + } + tokio::select! { opt = m.next() => { + tracing::trace!("Selected stream"); if let Some(res) = opt { match res { Ok(field) => { @@ -371,9 +389,11 @@ where } } else { stream_finished = true; + continue 'outer; } } opt = set.join_next() => { + tracing::trace!("Selected set"); if let Some(res) = opt { let (name_parts, content) = match res { Ok(Ok(Ok(tup))) => tup,