OIOMXESDNMLOTMNYCZZBYSBAQTYPAXXMUHTLA2AYCMNHZMPSLX2AC
6FEU6ES7L6M2W77TDTPKGCPCN3NRRHPH73ZN573D5BT2UFRVI7RQC
AI73GKAO5QBPR6YGW7H5UNZYAEGYGIHAFO6DM2DWCPMVYLHE547QC
L2VH4BYK3IULLGBHXMZJWKRKDQY43QEMQRTXFJCNRDE7PODLXWTAC
HKA66XOQ5LOF3E5DIQGVKPEZGZKCXLLYRVTKDK7SAD7Y5JZB5OUQC
IQ4FCHPZYGTZHCQHUIRCMUI5LCHIDSJCM2AZXGRJARWLCPPLXZOQC
FBXYP7QM7SG6P2JDJVQPPCRKJE3GVYXNQ5GVV4GRDUNG6Q4ZRDJQC
MU5GSJAW65PEG3BRYUKZ7O37BPHW3MOX3S5E2RFOXKGUOJEEDQ5AC
BVVMTOYWG4WSVWEYNW2XIG3D34Y7V54ACSSJPQ2AREOO7NGPMLDQC
TPEH2XNBS5RO4IEVKENVF6P65AH7IX64KK2JAYMSJT3J5GXO67EAC
VBMXB443FGZL6DLT6KAP2ICFCCQNXCUMDEUL67HB4CNKFMBBNSSAC
CCLLB7OIFNFYJZTG3UCI7536TOCWSCSXR67VELSB466R24WLJSDAC
JRENVH5DF2F4SOV7UNJENFA7VDI3H63XK76R3LFZK6QCW7JIBLSQC
SXEYMYF7P4RZMZ46WPL4IZUTSQ2ATBWYZX7QNVMS3SGOYXYOHAGQC
V435QOJRFHNKW3NKJHMVMFOGO3KGAZVSURLSGFUHVKOMHMF4Q2ZQC
2K7JLB4Z7BS5VFNWD4DO3MKYU7VNPA5MTVHVSDI3FQZ5ICM6XM6QC
QJXNUQFJOAPQT3GUXRDTVKMJZCKFONSXUZMAZB7VC7OHDCGAVCOQC
loop {
let (send, mut recv) = tokio::sync::mpsc::channel::<Option<bytes::Bytes>>(100);
let t = tokio::spawn(async move {
while let Some(chunk) = recv.recv().await {
match chunk {
Some(chunk) => {
trace!("writing {:?}", chunk.len());
use tokio::io::AsyncWriteExt;
f.write_all(&chunk).await?;
}
None => {
f.set_len(0).await?;
}
}
}
Ok::<_, std::io::Error>(())
});
let mut done = false;
while !done {
Ok(Some(chunk)) => {
debug!("writing {:?}", chunk.len());
f.write_all(&chunk)?;
}
Ok(None) => break true,
Err(_) => {
error!("Error while downloading {:?}, retrying", url);
Ok(Some(chunk)) => send.send(Some(chunk)).await?,
Ok(None) => done = true,
Err(e) => {
debug!("error {:?}", e);
error!("Error while downloading {:?} from {:?}, retrying", c32, url);
send.send(None).await?;