summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-19 03:53:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-19 03:53:11 +0200
commita184210f2e172745c9232cbf6b065bfe4d209d4e (patch)
tree7ee9f555aec74956c66f64a97bd1ad3a8910372c
parentbcc97326a254fec9ea6c9b04c977869428182690 (diff)
downloadfastd-a184210f2e172745c9232cbf6b065bfe4d209d4e.tar
fastd-a184210f2e172745c9232cbf6b065bfe4d209d4e.zip
Fix handling of new temporary peers
-rw-r--r--src/fastd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/fastd.c b/src/fastd.c
index d9e78b5..a226203 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -618,18 +618,19 @@ static void maintain_peer(fastd_context_t *ctx, fastd_peer_t *peer) {
}
}
-static void maintenance(fastd_context_t *ctx) {
- fastd_peer_t *peer, *next;
-
+static void enable_temporaries(fastd_context_t *ctx) {
while (ctx->peers_temp) {
- peer = ctx->peers_temp;
+ fastd_peer_t *peer = ctx->peers_temp;
ctx->peers_temp = ctx->peers_temp->next;
fastd_peer_enable_temporary(ctx, peer);
}
+}
+static void maintenance(fastd_context_t *ctx) {
fastd_socket_handle_binds(ctx);
+ fastd_peer_t *peer, *next;
for (peer = ctx->peers; peer; peer = next) {
next = peer->next;
maintain_peer(ctx, peer);
@@ -971,6 +972,8 @@ int main(int argc, char *argv[]) {
handle_input(&ctx);
+ enable_temporaries(&ctx);
+
if (fastd_timed_out(&ctx, &ctx.next_maintenance))
maintenance(&ctx);