diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-25 17:01:18 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-31 17:25:23 +0100 |
commit | 78e079c46c6ca0481ec77705db9ae4dec117be4e (patch) | |
tree | 6177dc8fbbec8755a8e2c32566f7922df7dedd5e /src/peer.h | |
parent | peer: get rid of peer_for_each magic (diff) | |
download | wireguard-monolithic-historical-78e079c46c6ca0481ec77705db9ae4dec117be4e.tar.xz wireguard-monolithic-historical-78e079c46c6ca0481ec77705db9ae4dec117be4e.zip |
peer: store total number of peers instead of iterating
This is faster, since it means adding a new peer is O(1) instead of
O(n). It's also safe to do because we're holding the device_update_lock
on both the ++ and the --.
Diffstat (limited to 'src/peer.h')
-rw-r--r-- | src/peer.h | 2 |
1 files changed, 0 insertions, 2 deletions
@@ -67,6 +67,4 @@ void peer_remove_all(struct wireguard_device *wg); struct wireguard_peer *peer_lookup_by_index(struct wireguard_device *wg, u32 index); -unsigned int peer_total_count(struct wireguard_device *wg); - #endif /* _WG_PEER_H */ |