File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,16 @@ impl Node {
381381 }
382382
383383 /// A peer node has disconnected from this one
384+ ///
385+ /// Note: It is safe if a call to `on_disconnect` is missed due to a new
386+ /// connection replacing the existing connection and resulting in a call
387+ /// to `on_connect` while the node thinks it still maintains a connection.
388+ ///
389+ /// All active behavior such as retries occur in `on_connect`. If the
390+ /// contents of this method change such that it is no longer safe to call
391+ /// `on_connect` without first calling `on_disconnect` for an already
392+ /// connected peer, then we can call `on_disconnect` first from directly
393+ /// within `on_connect`. For now that is unnecessary.
384394 pub fn on_disconnect (
385395 & mut self ,
386396 ctx : & mut impl NodeHandlerCtx ,
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ pub enum MainToConnMsg {
6262/// `Node::on_disconnect`.
6363///
6464/// By always returning the `task_id`, we allow cleanup of proxy requests for
65- /// stale nodes that will never complete.
65+ /// stale connections that will never complete.
6666pub struct DisconnectedPeer {
6767 pub task_id : task:: Id ,
6868 pub peer_id : Option < BaseboardId > ,
You can’t perform that action at this time.
0 commit comments