More work on the reciever end, and outfox format

This commit is contained in:
durch
2023-05-04 16:08:46 +02:00
parent 4d837a0402
commit 19c4b3255c
37 changed files with 1234 additions and 1622 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ where
}
async fn on_messages(&mut self, mut mix_packets: Vec<MixPacket>) {
debug_assert!(!mix_packets.is_empty());
assert!(!mix_packets.is_empty());
let result = if mix_packets.len() == 1 {
let mix_packet = mix_packets.pop().unwrap();
@@ -103,7 +103,7 @@ where
}
}
shutdown.recv_timeout().await;
log::debug!("MixTrafficController: Exiting");
log::error!("MixTrafficController: Exiting");
})
}
}
@@ -71,7 +71,8 @@ impl AcknowledgementListener {
while !shutdown.is_shutdown() {
tokio::select! {
acks = self.ack_receiver.next() => match acks {
Some(acks) => self.handle_ack_receiver_item(acks).await,
Some(acks) => {self.handle_ack_receiver_item(acks).await}
None => {
log::trace!("AcknowledgementListener: Stopping since channel closed");
break;
@@ -49,11 +49,11 @@ where
packet_recipient: Recipient,
chunk_data: Fragment,
) -> Result<PreparedFragment, PreparationError> {
info!("retransmitting normal packet...");
debug!("retransmitting normal packet...");
// TODO: Figure out retransmission packet type signaling
self.message_handler
.try_prepare_single_chunk_for_sending(packet_recipient, chunk_data, PacketType::Mix)
.try_prepare_single_chunk_for_sending(packet_recipient, chunk_data, PacketType::Outfox)
.await
}
@@ -431,7 +431,7 @@ where
lane: TransmissionLane,
packet_type: PacketType,
) -> Result<(), PreparationError> {
info!("Sending non-reply message with packet type {packet_type}");
debug!("Sending non-reply message with packet type {packet_type}");
// TODO: I really dislike existence of this assertion, it implies code has to be re-organised
debug_assert!(!matches!(message, NymMessage::Reply(_)));
@@ -439,7 +439,11 @@ where
let topology_permit = self.topology_access.get_read_permit().await;
let topology = self.get_topology(&topology_permit)?;
let packet_size = self.optimal_packet_size(&message);
let packet_size = if packet_type == PacketType::Outfox {
PacketSize::OutfoxRegularPacket
} else {
self.optimal_packet_size(&message)
};
debug!("Using {packet_size} packets for {message}");
let fragments = self
.message_preparer
@@ -482,7 +486,7 @@ where
amount: u32,
packet_type: PacketType,
) -> Result<(), PreparationError> {
info!("Sending additional reply SURBs with packet type {packet_type}");
debug!("Sending additional reply SURBs with packet type {packet_type}");
let sender_tag = self.get_or_create_sender_tag(&recipient);
let (reply_surbs, reply_keys) =
self.generate_reply_surbs_with_keys(amount as usize).await?;
@@ -514,7 +518,7 @@ where
lane: TransmissionLane,
packet_type: PacketType,
) -> Result<(), SurbWrappedPreparationError> {
info!("Sending message with reply SURBs with packet type {packet_type}");
debug!("Sending message with reply SURBs with packet type {packet_type}");
let sender_tag = self.get_or_create_sender_tag(&recipient);
let (reply_surbs, reply_keys) = self
.generate_reply_surbs_with_keys(num_reply_surbs as usize)
@@ -538,7 +542,7 @@ where
chunk: Fragment,
packet_type: PacketType,
) -> Result<PreparedFragment, PreparationError> {
info!("Sending single chunk with packet type {packet_type}");
debug!("Sending single chunk with packet type {packet_type}");
let topology_permit = self.topology_access.get_read_permit().await;
let topology = self.get_topology(&topology_permit)?;
@@ -353,7 +353,7 @@ impl<R: MessageReceiver> ReceivedMessagesBuffer<R> {
};
if let Some(completed) = completed_message {
info!("received {completed}");
debug!("received {completed}");
completed_messages.push(completed)
}
}