|
@@ -28,7 +28,8 @@ impl InboundSession {
|
|
|
accept_task: StoppableTask::new(),
|
|
accept_task: StoppableTask::new(),
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- /// Start the inbound session.
|
|
|
|
|
|
|
+ /// Starts the inbound session. Begins by accepting connections and fails if the address is not
|
|
|
|
|
+ /// configured. Then runs the channel subscription loop.
|
|
|
pub fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) -> NetResult<()> {
|
|
pub fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) -> NetResult<()> {
|
|
|
match self.p2p().settings().inbound {
|
|
match self.p2p().settings().inbound {
|
|
|
Some(accept_addr) => {
|
|
Some(accept_addr) => {
|
|
@@ -51,7 +52,7 @@ impl InboundSession {
|
|
|
|
|
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
- /// Stop the inbound session.
|
|
|
|
|
|
|
+ /// Stops the inbound session.
|
|
|
pub async fn stop(&self) {
|
|
pub async fn stop(&self) {
|
|
|
self.acceptor.stop().await;
|
|
self.acceptor.stop().await;
|
|
|
self.accept_task.stop().await;
|
|
self.accept_task.stop().await;
|
|
@@ -82,7 +83,10 @@ impl InboundSession {
|
|
|
.detach();
|
|
.detach();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /// Registers the channel.
|
|
|
|
|
+ /// Performs a network handshake and starts the channel. Then starts sending keep-alive and
|
|
|
|
|
+ /// address messages across the channel.
|
|
|
async fn setup_channel(
|
|
async fn setup_channel(
|
|
|
self: Arc<Self>,
|
|
self: Arc<Self>,
|
|
|
channel: ChannelPtr,
|
|
channel: ChannelPtr,
|
|
@@ -97,7 +101,7 @@ impl InboundSession {
|
|
|
self.attach_protocols(channel, executor).await
|
|
self.attach_protocols(channel, executor).await
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /// Network handshake.
|
|
|
|
|
|
|
+ /// Starts sending keep-alive and address messages across the channels.
|
|
|
async fn attach_protocols(
|
|
async fn attach_protocols(
|
|
|
self: Arc<Self>,
|
|
self: Arc<Self>,
|
|
|
channel: ChannelPtr,
|
|
channel: ChannelPtr,
|