Skip to content

Commit

Permalink
re-announce bug with timestamp refreshing (#51)
Browse files Browse the repository at this point in the history
* re-announce bug with timestamp refreshing

* Update info.rs
  • Loading branch information
hazel-sudz authored Dec 16, 2024
1 parent f8ce43c commit cdd4612
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ impl RouterHandler for InfoRouter {
for block in reader_writers.iter_mut().enumerate() {
if let Some(writer) = &mut block.1.writer {
if writer.announce_id == req.shard_id {
// update ip/port
// update ip/port and refresh timestamp
writer.ip = req.ip;
writer.port = req.port;
writer.timestamp = SystemTime::now();
// already announced
return AnnounceShardResponse {
writer_number: block.0 as u16,
Expand All @@ -83,9 +84,10 @@ impl RouterHandler for InfoRouter {
}
for reader in block.1.readers.iter_mut() {
if reader.announce_id == req.shard_id {
// update ip/port
// update ip/port and refresh timestamp
reader.ip = req.ip;
reader.port = req.port;
reader.timestamp = SystemTime::now();
// already announced
return AnnounceShardResponse {
writer_number: block.0 as u16,
Expand Down

0 comments on commit cdd4612

Please sign in to comment.