scatter_net/legacy/peer/methods/
begin_interaction.rs1use iroh::endpoint::ConnectionError;
2
3use crate::{Interaction, Peer};
4
5impl Peer {
6 pub async fn begin_interaction(self) -> Result<Interaction, PeerBeginInteractionError> {
7 let connection = self.read().connection.clone();
8 let channel = connection.open_bi().await?;
9 let interaction = Interaction::init(self, channel.1, channel.0);
10
11 Ok(interaction)
12 }
13}
14
15#[derive(thiserror::Error, Debug)]
16pub enum PeerBeginInteractionError {
17 #[error(transparent)]
18 Connection(#[from] ConnectionError),
19}