summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-19 23:54:10 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-19 23:54:10 +0200
commit0bf9268453d3af82bbd1257da547b1dd8f225ba2 (patch)
treec543378f2af2311683c741ec3111e16effd0ef28 /src/fastd.c
parent194e1c878aa383994fef0cbbb3449fdaa599b53a (diff)
downloadfastd-0bf9268453d3af82bbd1257da547b1dd8f225ba2.tar
fastd-0bf9268453d3af82bbd1257da547b1dd8f225ba2.zip
Keep peers in a hash table to allow fast address lookups
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fastd.c b/src/fastd.c
index f87f43e..1236e55 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -30,6 +30,7 @@
#include "crypto.h"
#include "handshake.h"
#include "peer.h"
+#include "peer_hashtable.h"
#include "poll.h"
#include <fastd_version.h>
@@ -854,6 +855,8 @@ int main(int argc, char *argv[]) {
VECTOR_ALLOC(ctx.peers, 0);
VECTOR_ALLOC(ctx.peers_temp, 0);
+ fastd_peer_hashtable_init(&ctx);
+
init_peers(&ctx);
while (!terminate) {
@@ -901,6 +904,8 @@ int main(int argc, char *argv[]) {
on_post_down(&ctx);
+ fastd_peer_hashtable_free(&ctx);
+
VECTOR_FREE(ctx.peers_temp);
VECTOR_FREE(ctx.peers);
VECTOR_FREE(ctx.eth_addrs);