mirror of
https://github.com/G2-Games/minidisc-cli.git
synced 2025-04-19 11:42:53 -05:00
Fixed issue with _read_reply()
in base.rs
This commit is contained in:
parent
c563a41781
commit
e7d21253d8
1 changed files with 11 additions and 7 deletions
|
@ -243,12 +243,19 @@ impl NetMD {
|
|||
use_factory_command: bool,
|
||||
override_length: Option<i32>,
|
||||
) -> Result<Vec<u8>, Box<dyn Error>> {
|
||||
let mut length = self.poll().await?.0;
|
||||
let mut length = 0;
|
||||
|
||||
for attempt in 0..75 {
|
||||
if attempt == 75 {
|
||||
for attempt in 0..40 {
|
||||
if attempt == 39 {
|
||||
return Err("Failed to get response length".into());
|
||||
}
|
||||
|
||||
length = self.poll().await?.0;
|
||||
|
||||
if length > 0 {
|
||||
break
|
||||
}
|
||||
|
||||
// Back off while trying again
|
||||
let sleep_time = Self::READ_REPLY_RETRY_INTERVAL as u64
|
||||
* (u64::pow(2, attempt as u32 / 10) - 1);
|
||||
|
@ -259,10 +266,7 @@ impl NetMD {
|
|||
#[cfg(target_family = "wasm")]
|
||||
TimeoutFuture::new(sleep_time as u32).await;
|
||||
|
||||
length = self.poll().await?.0;
|
||||
if length > 0 {
|
||||
break
|
||||
}
|
||||
println!("{}", attempt);
|
||||
}
|
||||
|
||||
if let Some(value) = override_length {
|
||||
|
|
Loading…
Reference in a new issue