|
@@ -284,6 +284,7 @@ async fn receive_action<
|
|
conversation: Conversation<T>,
|
|
conversation: Conversation<T>,
|
|
stream_map: &mut M,
|
|
stream_map: &mut M,
|
|
our_id: &str,
|
|
our_id: &str,
|
|
|
|
+ p2p: bool,
|
|
rng: &mut Xoshiro256PlusPlus,
|
|
rng: &mut Xoshiro256PlusPlus,
|
|
) -> StateMachine {
|
|
) -> StateMachine {
|
|
match msg.body {
|
|
match msg.body {
|
|
@@ -299,7 +300,8 @@ async fn receive_action<
|
|
size
|
|
size
|
|
);
|
|
);
|
|
let stream = stream_map.channel_for(&msg.sender);
|
|
let stream = stream_map.channel_for(&msg.sender);
|
|
- let m = construct_receipt(our_id.to_string(), msg.sender);
|
|
|
|
|
|
+ let recipient = if p2p { msg.group } else { msg.sender };
|
|
|
|
+ let m = construct_receipt(our_id.to_string(), recipient);
|
|
stream
|
|
stream
|
|
.channel
|
|
.channel
|
|
.send(S::new(m))
|
|
.send(S::new(m))
|
|
@@ -338,6 +340,7 @@ pub async fn manage_idle_conversation<
|
|
stream_map: &'a mut M,
|
|
stream_map: &'a mut M,
|
|
our_id: &str,
|
|
our_id: &str,
|
|
group: &str,
|
|
group: &str,
|
|
|
|
+ p2p: bool,
|
|
rng: &mut Xoshiro256PlusPlus,
|
|
rng: &mut Xoshiro256PlusPlus,
|
|
) -> StateMachine {
|
|
) -> StateMachine {
|
|
log!("{},{},Idle", our_id, group);
|
|
log!("{},{},Idle", our_id, group);
|
|
@@ -353,7 +356,7 @@ pub async fn manage_idle_conversation<
|
|
send_action(conversation, stream_map.values(), our_id, group, rng).await
|
|
send_action(conversation, stream_map.values(), our_id, group, rng).await
|
|
}
|
|
}
|
|
IdleGroupActions::Receive(msg) => {
|
|
IdleGroupActions::Receive(msg) => {
|
|
- receive_action(msg, conversation, stream_map, our_id, rng).await
|
|
|
|
|
|
+ receive_action(msg, conversation, stream_map, our_id, p2p, rng).await
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -376,6 +379,7 @@ pub async fn manage_active_conversation<
|
|
stream_map: &'a mut M,
|
|
stream_map: &'a mut M,
|
|
our_id: &str,
|
|
our_id: &str,
|
|
group: &str,
|
|
group: &str,
|
|
|
|
+ p2p: bool,
|
|
rng: &mut Xoshiro256PlusPlus,
|
|
rng: &mut Xoshiro256PlusPlus,
|
|
) -> StateMachine {
|
|
) -> StateMachine {
|
|
let action = tokio::select! {
|
|
let action = tokio::select! {
|
|
@@ -390,7 +394,7 @@ pub async fn manage_active_conversation<
|
|
send_action(conversation, stream_map.values(), our_id, group, rng).await
|
|
send_action(conversation, stream_map.values(), our_id, group, rng).await
|
|
}
|
|
}
|
|
ActiveGroupActions::Receive(msg) => {
|
|
ActiveGroupActions::Receive(msg) => {
|
|
- receive_action(msg, conversation, stream_map, our_id, rng).await
|
|
|
|
|
|
+ receive_action(msg, conversation, stream_map, our_id, p2p, rng).await
|
|
}
|
|
}
|
|
ActiveGroupActions::Idle => StateMachine::Idle(conversation.waited(rng)),
|
|
ActiveGroupActions::Idle => StateMachine::Idle(conversation.waited(rng)),
|
|
}
|
|
}
|