mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 14:26:30 +03:00
refactor: assert that Iroh node addresses have home relay URL
With newer Iroh it is possible to obtain own node address before home relay is selected and accidentally send own address without relay URL. It took me some time to debug why Iroh 0.92.0 did not work with iroh-relay 0.92.0 so I'm adding these assertions even while we still use Iroh 0.35.0.
This commit is contained in:
@@ -1522,16 +1522,19 @@ impl MimeFactory {
|
||||
));
|
||||
}
|
||||
SystemMessage::IrohNodeAddr => {
|
||||
let node_addr = context
|
||||
.get_or_try_init_peer_channel()
|
||||
.await?
|
||||
.get_node_addr()
|
||||
.await?;
|
||||
|
||||
// We should not send `null` as relay URL
|
||||
// as this is the only way to reach the node.
|
||||
debug_assert!(node_addr.relay_url().is_some());
|
||||
headers.push((
|
||||
HeaderDef::IrohNodeAddr.into(),
|
||||
mail_builder::headers::text::Text::new(serde_json::to_string(
|
||||
&context
|
||||
.get_or_try_init_peer_channel()
|
||||
.await?
|
||||
.get_node_addr()
|
||||
.await?,
|
||||
)?)
|
||||
.into(),
|
||||
mail_builder::headers::text::Text::new(serde_json::to_string(&node_addr)?)
|
||||
.into(),
|
||||
));
|
||||
}
|
||||
SystemMessage::CallAccepted => {
|
||||
|
||||
Reference in New Issue
Block a user