summaryrefslogtreecommitdiffstats
path: root/src/transport/wire.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/wire.rs')
-rw-r--r--src/transport/wire.rs28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/transport/wire.rs b/src/transport/wire.rs
index 009380f..ceeaf87 100644
--- a/src/transport/wire.rs
+++ b/src/transport/wire.rs
@@ -14,7 +14,7 @@ use super::{MessageKind, ParsedMessage};
/// The wire format's version, the first byte of every payload. Bump it with every change
/// to a message type or a codec (`golden_bytes` fails then).
-pub(crate) const VERSION: u8 = 3;
+pub(crate) const VERSION: u8 = 4;
/// What the second byte of a payload says.
fn tag(kind: MessageKind) -> u8 {
@@ -300,7 +300,7 @@ mod tests {
use crate::document::replica::Epoch;
use crate::transport::{
BlobBody, BlobId, BlobMessage, HeadsSummary, HelloReply, HelloRequest, Keepalive,
- MAX_LISTED_HEADS,
+ ListedPeer, MAX_LISTED_HEADS,
};
use automerge::ChangeHash;
@@ -330,7 +330,10 @@ mod tests {
let reply = ParsedMessage::HelloReply(HelloReply {
swarm_id: "swarm".into(),
- peers: vec!["p".into()],
+ peers: vec![ListedPeer {
+ id: "p".into(),
+ addresses: vec!["a".into()],
+ }],
epoch,
epoch_seq: 1,
auth: Vec::new(),
@@ -342,7 +345,13 @@ mod tests {
let ParsedMessage::HelloReply(decoded) = decode(&encode(&reply).unwrap()).unwrap() else {
panic!("not a HELLO_REPLY");
};
- assert_eq!(decoded.peers, vec!["p".to_owned()]);
+ assert_eq!(
+ decoded.peers,
+ vec![ListedPeer {
+ id: "p".into(),
+ addresses: vec!["a".into()],
+ }]
+ );
assert_eq!(decoded.away_ms, Some(5));
assert_eq!(decoded.sender_run_id, [6; 16]);
}
@@ -438,12 +447,15 @@ mod tests {
});
assert_eq!(
hex(&encode(&hello).unwrap()),
- format!("030097a5737761726d{epoch_hex}01c403010203c3{}07", run("04"))
+ format!("040097a5737761726d{epoch_hex}01c403010203c3{}07", run("04"))
);
let reply = ParsedMessage::HelloReply(HelloReply {
swarm_id: "swarm".into(),
- peers: vec!["p".into()],
+ peers: vec![ListedPeer {
+ id: "p".into(),
+ addresses: vec!["a".into()],
+ }],
epoch,
epoch_seq: 1,
auth: Vec::new(),
@@ -455,7 +467,7 @@ mod tests {
assert_eq!(
hex(&encode(&reply).unwrap()),
format!(
- "030199a5737761726d91a170{epoch_hex}01c400c2{}05{}",
+ "040199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}",
run("04"),
run("06")
)
@@ -470,7 +482,7 @@ mod tests {
});
assert_eq!(
hex(&encode(&ping).unwrap()),
- format!("0303959290c400{epoch_hex}01c3c2")
+ format!("0403959290c400{epoch_hex}01c3c2")
);
}
}