From b5d83e3988d346af26b479b7c1be96185de040aa Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 20 Jan 2015 22:51:40 +0100 Subject: Implement new hash table to keep track of unknown peers handshakes have been sent to This should significantly reduce the number of handshakes sent after restarting fastd with many active connections. --- src/fastd.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/fastd.h') diff --git a/src/fastd.h b/src/fastd.h index cecb542..9d240b2 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -320,8 +320,8 @@ struct fastd_context { VECTOR(fastd_peer_eth_addr_t) eth_addrs; /**< Sorted vector of all known ethernet addresses with associated peers and timeouts */ - size_t unknown_handshake_pos; /**< Current start position in the ring buffer unknown_handshakes */ - fastd_handshake_timeout_t unknown_handshakes[8]; /**< Ring buffer of unknown addresses handshakes have been received from */ + uint32_t unknown_handshake_seed; /**< Hash seed for the unknown handshake hashtables */ + fastd_handshake_timeout_t *unknown_handshakes[UNKNOWN_TABLES]; /**< Hash tables unknown addresses handshakes have been sent to */ fastd_protocol_state_t *protocol_state; /**< Protocol-specific state */ }; @@ -341,6 +341,8 @@ void fastd_send(const fastd_socket_t *sock, const fastd_peer_address_t *local_ad void fastd_send_handshake(const fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, fastd_peer_t *peer, fastd_buffer_t buffer); void fastd_send_data(fastd_buffer_t buffer, fastd_peer_t *source); +void fastd_receive_unknown_init(void); +void fastd_receive_unknown_free(void); void fastd_receive(fastd_socket_t *sock); void fastd_handle_receive(fastd_peer_t *peer, fastd_buffer_t buffer, bool reordered); -- cgit v1.2.3