diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-19 22:03:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-19 22:03:07 +0200 |
commit | 194e1c878aa383994fef0cbbb3449fdaa599b53a (patch) | |
tree | fbb4ce72496c28659db2848c75edfbe8a59bc952 /src/fastd.h | |
parent | 6798a76ffa1b4de4ec0ea07286c3510d86c0e3b6 (diff) | |
download | fastd-194e1c878aa383994fef0cbbb3449fdaa599b53a.tar fastd-194e1c878aa383994fef0cbbb3449fdaa599b53a.zip |
Keep a vector of pollfds instead of regenerating it all the time
Diffstat (limited to 'src/fastd.h')
-rw-r--r-- | src/fastd.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/fastd.h b/src/fastd.h index 9cd6b2a..a116baf 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -34,6 +34,7 @@ #include "vector.h" #include <errno.h> +#include <poll.h> #include <stdarg.h> #include <stddef.h> #include <stdio.h> @@ -240,6 +241,8 @@ struct fastd_context { fastd_peer_group_t *peer_group; VECTOR(fastd_peer_t*) peers; + VECTOR(struct pollfd) pollfds; + VECTOR(fastd_peer_t*) peers_temp; fastd_dlist_head_t handshake_queue; @@ -401,6 +404,10 @@ static inline struct timespec fastd_in_seconds(const fastd_context_t *ctx, int s return ret; } +static inline void fastd_update_time(fastd_context_t *ctx) { + clock_gettime(CLOCK_MONOTONIC, &ctx->now); +} + static inline bool strequal(const char *str1, const char *str2) { if (str1 && str2) return (!strcmp(str1, str2)); |