From 3065f96f7b833701a03f5759bfc593a7f6943c4e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 27 Mar 2012 22:43:19 +0200 Subject: New handshake format; don't respond to data packets from unknown peers with handshakes, but request a re-handshake --- src/fastd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/fastd.c') diff --git a/src/fastd.c b/src/fastd.c index d2e0881..70f4248 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -180,14 +180,14 @@ static void handle_tasks(fastd_context *ctx) { break; case TASK_HANDSHAKE: - if (task->peer->state != STATE_WAIT && task->peer->state != STATE_TEMP) + if (task->peer->state != STATE_WAIT && task->peer->state != STATE_TEMP && !task->handshake.force) break; pr_debug(ctx, "Sending handshake to %P...", task->peer); fastd_handshake_send(ctx, task->peer); if (task->peer->state == STATE_WAIT) - fastd_task_schedule_handshake(ctx, task->peer, 20000); + fastd_task_schedule_handshake(ctx, task->peer, 20000, false); break; default: @@ -314,7 +314,9 @@ static void handle_socket(fastd_context *ctx, int sockfd) { fastd_buffer_free(buffer); peer = fastd_peer_add_temp(ctx, (fastd_peer_address*)&recvaddr); - fastd_task_schedule_handshake(ctx, peer, 0); + ctx->conf->protocol->handle_recv(ctx, peer, buffer); + pr_debug(ctx, "Requesting re-handshake from %P", peer); + fastd_handshake_rehandshake(ctx, peer); break; case PACKET_HANDSHAKE: -- cgit v1.2.3