From ee8b2de4b795fbc3b292e14c9f088244a7e08690 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 31 Mar 2012 19:38:18 +0200 Subject: ecfxp: refresh session key periodically --- src/fastd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/fastd.c') diff --git a/src/fastd.c b/src/fastd.c index a651946..a0acbb1 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -207,13 +207,13 @@ static void handle_tasks(fastd_context *ctx) { break; case TASK_HANDSHAKE: - if (task->peer->state != STATE_WAIT && task->peer->state != STATE_TEMP) - break; - pr_debug(ctx, "Sending handshake to %P...", task->peer); ctx->conf->protocol->handshake_init(ctx, task->peer); - fastd_task_schedule_handshake(ctx, task->peer, 20000); + if (fastd_peer_is_established(task->peer)) + fastd_task_schedule_handshake(ctx, task->peer, fastd_rand(ctx, 10000, 20000)); + else + fastd_task_schedule_handshake(ctx, task->peer, 20000); break; default: @@ -412,6 +412,8 @@ int main(int argc, char *argv[]) { fastd_context ctx; memset(&ctx, 0, sizeof(ctx)); + fastd_random_bytes(&ctx, &ctx.randseed, sizeof(ctx.randseed), false); + fastd_config conf; fastd_configure(&ctx, &conf, argc, argv); ctx.conf = &conf; -- cgit v1.2.3