diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-02-26 01:02:35 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-02-26 01:02:35 +0100 |
commit | 4ab4858d5473c816cc526b296ae9da6c6956219d (patch) | |
tree | 67ac9253e6aa74a68699aa2a9e8e43d89e14c088 /src/fastd.c | |
parent | 87b9b80a55d3567e76fc86d3abc7f3cfd6d92e6f (diff) | |
download | fastd-4ab4858d5473c816cc526b296ae9da6c6956219d.tar fastd-4ab4858d5473c816cc526b296ae9da6c6956219d.zip |
Experimental support for accepting connections from unknown peers
Diffstat (limited to 'src/fastd.c')
-rw-r--r-- | src/fastd.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/fastd.c b/src/fastd.c index ce297f7..89125a9 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -975,14 +975,27 @@ static void cleanup_peers(fastd_context_t *ctx) { for (peer = ctx->peers; peer; peer = next) { next = peer->next; - if (fastd_peer_is_established(peer)) { - if (timespec_diff(&ctx->now, &peer->seen) > ctx->conf->peer_stale_time*1000) - fastd_peer_reset(ctx, peer); + if (fastd_peer_is_temporary(peer) || fastd_peer_is_established(peer)) { + if (timespec_diff(&ctx->now, &peer->seen) > ctx->conf->peer_stale_time*1000) { + if (fastd_peer_is_temporary(peer)) { + fastd_peer_delete(ctx, peer); + } + else { + fastd_peer_reset(ctx, peer); + } + } } } } static void maintenance(fastd_context_t *ctx) { + while (ctx->peers_temp) { + fastd_peer_t *peer = ctx->peers_temp; + ctx->peers_temp = ctx->peers_temp->next; + + fastd_peer_enable_temporary(ctx, peer); + } + cleanup_peers(ctx); fastd_peer_eth_addr_cleanup(ctx); |