diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-27 22:43:19 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-27 22:43:19 +0200 |
commit | 3065f96f7b833701a03f5759bfc593a7f6943c4e (patch) | |
tree | 7413b460332130fc760f1c3a579a502e5e7454ea /src/fastd.c | |
parent | 2190d635c1bb7d917c16b543b78d74a4ca9a735d (diff) | |
download | fastd-3065f96f7b833701a03f5759bfc593a7f6943c4e.tar fastd-3065f96f7b833701a03f5759bfc593a7f6943c4e.zip |
New handshake format; don't respond to data packets from unknown peers with handshakes, but request a re-handshake
Diffstat (limited to 'src/fastd.c')
-rw-r--r-- | src/fastd.c | 8 |
1 files changed, 5 insertions, 3 deletions
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: |