Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
fix: change how NodeEventSource treats closed connection
Lars Wirzenius committed 1 year ago
commit 0ac3b62301d5779b6077c16c202120b7f6bdc35a
parent 3a345c649263f7daec33bd09a9a21ac0638dbfb4
1 file changed +5 -1
modified src/node_event_source.rs
@@ -42,7 +42,11 @@ impl NodeEventSource {
    /// filtering. This will block until there is an event, or until
    /// there will be no more events from this source, or there's an
    /// error.
+
    ///
+
    /// A closed or broken connection to the node is not an error,
+
    /// it's treated as end of file.
    pub fn node_event(&mut self) -> Result<Option<Event>, NodeEventError> {
+
        logger::debug("node_event: try to get an event");
        if let Some(event) = self.events.next() {
            match event {
                Ok(event) => {
@@ -53,7 +57,7 @@ impl NodeEventSource {
                    if err.kind() == std::io::ErrorKind::ConnectionReset =>
                {
                    logger::event_disconnected();
-
                    Err(NodeEventError::BrokenConnection)
+
                    Ok(None)
                }
                Err(err) => {
                    logger::error("error reading event from node", &err);