summaryrefslogtreecommitdiffstats
path: root/src/transport/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/mod.rs')
-rw-r--r--src/transport/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index e46e82e..f20110a 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -134,7 +134,8 @@ pub(crate) struct Status {
pub(crate) syncs_with_you: bool,
}
-#[derive(Debug)]
+/// Cheap to clone: large parts are shared (`bytes::Bytes`).
+#[derive(Debug, Clone)]
pub(crate) enum ParsedMessage {
Hello(HelloRequest),
HelloReply(HelloReply),
@@ -537,6 +538,9 @@ pub(crate) struct EncodedMessage {
pub(crate) kind: MessageKind,
/// Bytes the message takes on the wire (without the transport's own framing).
pub(crate) payload_len: usize,
+ /// The message itself, under the paths layer (`transport::paths`): to encode it
+ /// again for another transport when a send there fails. None from a transport.
+ pub(crate) message: Option<std::sync::Arc<ParsedMessage>>,
}
/// Called with the sender, the message and its `payload_len` (as in `EncodedMessage`).