Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node/upload_pack: Do not check timeout again
Lorenz Leutgeb committed 1 month ago
commit c2ce7bbd31d69c8df4be156020d5ff21506f15e9
parent edde15d9ea700a70de04558fafc0b55360e9f5d2
1 file changed +0 -16
modified crates/radicle-node/src/worker/upload_pack.rs
@@ -130,15 +130,6 @@ where
                        log::debug!(target: "worker", "Exiting upload-pack reader thread for {}", header.repo);
                        break;
                    }
-
                    Err(e) if e.kind() == io::ErrorKind::TimedOut => {
-
                        log::debug!(target: "worker", "Read channel timed out for upload-pack {}", header.repo);
-
                        // N.b. if the read timed out, ensure that the sender isn't
-
                        // still sending messages.
-
                        let lock = reporter.lock().expect("FATAL: upload_pack poisoned lock");
-
                        if lock.is_timeout(timeout) {
-
                            break;
-
                        }
-
                    }
                    Err(e) => {
                        log::debug!(target: "worker", "Failure on upload-pack channel read for {}: {e}", header.repo);
                        emitter.emit(events::UploadPack::error(header.repo, remote, e).into());
@@ -175,7 +166,6 @@ struct Reporter<W> {
    emitter: Emitter<Event>,
    send: W,
    total: usize,
-
    last_sent: Instant,
}

impl<W> Reporter<W> {
@@ -186,14 +176,9 @@ impl<W> Reporter<W> {
            emitter,
            send,
            total: 0,
-
            last_sent: Instant::now(),
        }
    }

-
    fn is_timeout(&self, timeout: Duration) -> bool {
-
        Instant::now().duration_since(self.last_sent) > timeout
-
    }
-

    fn emit(&mut self, buf: &[u8]) {
        let event = match Self::as_upload_pack_progress(buf) {
            Some(progress) => events::UploadPack::write(self.rid, self.remote, progress),
@@ -230,7 +215,6 @@ where
    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
        let n = self.send.write(buf)?;
        self.emit(buf);
-
        self.last_sent = Instant::now();
        Ok(n)
    }