This commit is contained in:
boqiu 2024-10-25 11:31:54 +08:00
parent 247b1aaf8f
commit 98438fd0e5
3 changed files with 15 additions and 5 deletions

View File

@ -398,7 +398,8 @@ impl Libp2pEventHandler {
};
// update shard config cache
self.file_location_cache.insert_peer_config(from, announced_shard_config);
self.file_location_cache
.insert_peer_config(from, announced_shard_config);
// ignore if already exists
match self.store.check_tx_completed(msg.tx_id.seq).await {

View File

@ -1543,7 +1543,10 @@ mod tests {
controller.on_response(peer_id, chunks).await;
assert_eq!(*controller.get_status(), SyncState::Completed);
assert!(matches!(network_recv.try_recv().unwrap(), NetworkMessage::AnnounceLocalFile { .. }));
assert!(matches!(
network_recv.try_recv().unwrap(),
NetworkMessage::AnnounceLocalFile { .. }
));
assert!(network_recv.try_recv().is_err());
}

View File

@ -1558,7 +1558,10 @@ mod tests {
.await;
wait_for_tx_finalized(runtime.store.clone(), tx_seq).await;
assert!(matches!(runtime.network_recv.try_recv().unwrap(), NetworkMessage::AnnounceLocalFile { .. }));
assert!(matches!(
runtime.network_recv.try_recv().unwrap(),
NetworkMessage::AnnounceLocalFile { .. }
));
assert!(!runtime.store.check_tx_completed(0).unwrap());
@ -1568,7 +1571,7 @@ mod tests {
.request(SyncRequest::SyncFile { tx_seq })
.await
.unwrap();
receive_dial(&mut runtime, &sync_send).await;
receive_chunk_request(
@ -1583,7 +1586,10 @@ mod tests {
.await;
wait_for_tx_finalized(runtime.store, tx_seq).await;
assert!(matches!(runtime.network_recv.try_recv().unwrap(), NetworkMessage::AnnounceLocalFile { .. }));
assert!(matches!(
runtime.network_recv.try_recv().unwrap(),
NetworkMessage::AnnounceLocalFile { .. }
));
sync_send
.notify(SyncMessage::PeerDisconnected {