Skip to content

Commit

Permalink
Merge pull request #77 from tntech-ngin/fix/first-segment
Browse files Browse the repository at this point in the history
Fix/first segment
  • Loading branch information
sankalpatimilsina12 committed Sep 2, 2024
2 parents bb2a21a + eed0d10 commit a0923cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion ndn_hydra/client/functions/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions ndn_hydra/client/functions/insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down
4 changes: 2 additions & 2 deletions ndn_hydra/repo/utils/concurrent_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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)))
Expand Down

0 comments on commit a0923cd

Please sign in to comment.