diff --git a/ndn_hydra/client/functions/fetch.py b/ndn_hydra/client/functions/fetch.py index 4d46b26..8b858d7 100644 --- a/ndn_hydra/client/functions/fetch.py +++ b/ndn_hydra/client/functions/fetch.py @@ -64,7 +64,6 @@ async def fetch_file(self, file_name: FormalName, local_filename: str = None, ov return if meta_info.content_type == ContentType.LINK: - print(f"First Packet Content: {bytes(content).decode()}") # name_at_repo = Name.from_str(bytes(content).decode()) forwarding_hint = [(1, bytes(content).decode())] # else: diff --git a/ndn_hydra/client/functions/insert.py b/ndn_hydra/client/functions/insert.py index c689bc2..d1dc382 100644 --- a/ndn_hydra/client/functions/insert.py +++ b/ndn_hydra/client/functions/insert.py @@ -62,12 +62,12 @@ async def insert_file(self, file_name: FormalName, path: str) -> bool: final_block_id = Component.from_segment(seg_cnt - 1) inner_packets = [self.app.prepare_data(packet_prefix + [Component.from_segment(i)], data[i * SEGMENT_SIZE:(i + 1) * SEGMENT_SIZE], - freshness_period=0, + freshness_period=2000, final_block_id=final_block_id) for i in range(seg_cnt)] self.packets = [self.app.prepare_data(publish_prefix + [Component.from_segment(i)], packet, - freshness_period=0, + freshness_period=2000, final_block_id=final_block_id) for i, packet in enumerate(inner_packets)] diff --git a/ndn_hydra/repo/utils/concurrent_fetcher.py b/ndn_hydra/repo/utils/concurrent_fetcher.py index 19dd240..065d1c2 100644 --- a/ndn_hydra/repo/utils/concurrent_fetcher.py +++ b/ndn_hydra/repo/utils/concurrent_fetcher.py @@ -34,7 +34,7 @@ async def concurrent_fetcher(app: NDNApp, name: NonStrictName, file_name: NonStr # Progress bar total_blocks = final_id - start_block_id + 1 - progress_bar = tqdm(initial=start_block_id, total=total_blocks, desc='Fetching data', unit='block') + progress_bar = tqdm(total=total_blocks, desc='Fetching data', unit='block') async def _retry(seq: int): """ @@ -58,7 +58,7 @@ async def _retry(seq: int): try: # logging.info('Express Interest: {}'.format(Name.to_str(int_name))) data_name, meta_info, content, data_bytes = await app.express_interest( - int_name, need_raw_packet=True, can_be_prefix=False, must_be_fresh=seq==0, lifetime=4000, **kwargs) + int_name, need_raw_packet=True, can_be_prefix=False, must_be_fresh=False, lifetime=4000, **kwargs) # Save data and update final_id # logging.info('Received data: {}'.format(Name.to_str(data_name)))