File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,13 @@ pub trait ProtocolHandler: Send + Sync + std::fmt::Debug + 'static {
175175 ///
176176 /// Can be implemented as `async fn accept(&self, connection: Connection) -> Result<()>`.
177177 ///
178- /// The returned future runs on a freshly spawned tokio task so it can be long-running.
178+ /// The returned future runs on a freshly spawned tokio task so it can be long-running. Once
179+ /// `accept()` returns, the connection is closed, so the returned future is expected
180+ /// to drive the protocol to completion. If there in a protocol error, you can
181+ /// use [`Connection::close`] to send an error code to the remote peer. Returning
182+ /// an `Err<AcceptError>` will also close the connection and log a warning, but no
183+ /// dedicated error code will be sent to the peer, so it's recommended to explicitly
184+ /// close the connection within your accept handler.
179185 ///
180186 /// When [`Router::shutdown`] is called, no further connections will be accepted, and
181187 /// the futures returned by [`Self::accept`] will be aborted after the future returned
You can’t perform that action at this time.
0 commit comments