Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Gossip once we switch to gossip protocol
Alexis Sellier committed 3 years ago
commit fb635d80c391e12c1de80842da92c53e97b5c01e
parent ad63583bee62015e59b073c904cd96aed2f52cd1
1 file changed +15 -10
modified radicle-node/src/service.rs
@@ -636,6 +636,21 @@ where
                    error!(target: "service", "Failed to announce new refs: {e}");
                }
            }
+
        }
+

+
        if let Some(session) = self.sessions.get_mut(&remote) {
+
            // Transition session back to gossip protocol.
+
            session.to_gossip();
+
            // Drain any messages in the session's outbox, which might have accumulated during the
+
            // fetch, and send them to the peer.
+
            self.reactor.drain(session);
+
        } else {
+
            log::debug!(target: "service", "Session not found for {remote}");
+
        }
+

+
        // Nb. This block needs to be run after we've switched back to the gossip protocol,
+
        // otherwise the messages will be queued.
+
        if initiated {
            // TODO: Since this fetch could be either a full clone or simply a ref update, we need
            // to either announce new inventory, or new refs. Right now, we announce both in some
            // cases.
@@ -658,16 +673,6 @@ where
                }
            }
        }
-

-
        if let Some(session) = self.sessions.get_mut(&remote) {
-
            // Transition session back to gossip protocol.
-
            session.to_gossip();
-
            // Drain any messages in the session's outbox, which might have accumulated during the
-
            // fetch, and send them to the peer.
-
            self.reactor.drain(session);
-
        } else {
-
            log::debug!(target: "service", "Session not found for {remote}");
-
        }
    }

    pub fn accepted(&mut self, _addr: net::SocketAddr) {