diff --git a/zebra-network/src/peer/client.rs b/zebra-network/src/peer/client.rs index f925a55a8..939db8cf8 100644 --- a/zebra-network/src/peer/client.rs +++ b/zebra-network/src/peer/client.rs @@ -25,11 +25,14 @@ pub struct Client { /// A message from the `peer::Client` to the `peer::Server`. #[derive(Debug)] +#[must_use = "tx.send() must be called before drop"] pub(super) struct ClientRequest { /// The actual request. pub request: Request, /// The return message channel, included because `peer::Client::call` returns a /// future that may be moved around before it resolves. + /// + /// INVARIANT: `tx.send()` must be called before dropping `tx`. pub tx: oneshot::Sender>, /// The tracing context for the request, so that work the connection task does /// processing messages in the context of this request will have correct context. diff --git a/zebra-network/src/peer/connection.rs b/zebra-network/src/peer/connection.rs index 78838c570..3628ceade 100644 --- a/zebra-network/src/peer/connection.rs +++ b/zebra-network/src/peer/connection.rs @@ -304,6 +304,7 @@ impl Handler { } } +#[must_use = "AwaitingResponse.tx.send() must be called before drop"] pub(super) enum State { /// Awaiting a client request or a peer message. AwaitingRequest,