From 0bf9268453d3af82bbd1257da547b1dd8f225ba2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 19 Apr 2014 23:54:10 +0200 Subject: Keep peers in a hash table to allow fast address lookups --- src/fastd.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/fastd.c') 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 @@ -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); -- cgit v1.2.3