Skip to content

Commit

Permalink
feat(kad): add mode getter on Behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-frb committed Aug 28, 2024
1 parent 64c6eb2 commit e3609c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions protocols/kad/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

- Expose a kad query facility allowing specify num_results dynamicly.
See [PR 5555](https://github.com/libp2p/rust-libp2p/pull/5555).
- Add `mode` getter on `Behaviour`.
See [PR 5555](https://github.com/libp2p/rust-libp2p/pull/5555).


## 0.46.2

Expand Down
5 changes: 5 additions & 0 deletions protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,11 @@ where
}
}

/// Get the [`Mode`] in which the DHT is currently operating.
pub fn mode(&self) -> Mode {
self.mode
}

fn reconfigure_mode(&mut self) {
if self.connections.is_empty() {
return;
Expand Down

0 comments on commit e3609c5

Please sign in to comment.