File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,13 @@ type THandlerInEvent<THandler> =
152152/// struct members are delegated to [`NetworkBehaviourEventProcess`] implementations. Those must be
153153/// provided by the user on the type that [`NetworkBehaviour`] is derived on.
154154///
155+ /// Because these implementations are granted exclusive access to the [`NetworkBehaviour`],
156+ /// [blocking code](https://ryhl.io/blog/async-what-is-blocking/) in these implementations will
157+ /// block the entire [`Swarm`](crate::Swarm) from processing new events, since the swarm cannot progress
158+ /// without also having exclusive access to the [`NetworkBehaviour`]. A better alternative is to execute
159+ /// blocking or asynchronous logic on a separate task, perhaps with the help of a bounded channel to
160+ /// maintain backpressure. The sender for the channel could be included in the NetworkBehaviours constructor.
161+ ///
155162/// Optionally one can provide a custom `poll` function through the `#[behaviour(poll_method =
156163/// "poll")]` attribute. This function must have the same signature as the [`NetworkBehaviour#poll`]
157164/// function and will be called last within the generated [`NetworkBehaviour`] implementation.
You can’t perform that action at this time.
0 commit comments