summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-31 19:38:18 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-31 19:38:18 +0200
commitee8b2de4b795fbc3b292e14c9f088244a7e08690 (patch)
tree561cfa9b830d315e4307d8c1aeceb1c475e192da /src/fastd.c
parent0c82651c30bf543903ca05df4e5b179201353ee1 (diff)
downloadfastd-ee8b2de4b795fbc3b292e14c9f088244a7e08690.tar
fastd-ee8b2de4b795fbc3b292e14c9f088244a7e08690.zip
ecfxp: refresh session key periodically
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c10
1 files changed, 6 insertions, 4 deletions
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;