summaryrefslogtreecommitdiffstats
path: root/src/protocol_null.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-02 01:28:34 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-02 01:28:34 +0200
commit3c83faaa1660a70932c14b0fb1f9175b531cdf10 (patch)
tree920f34939c1cabafed056bbd6f51898991616e85 /src/protocol_null.c
parent9e45032bd53d07e78c2ec41f1ae9d0d75e4910ce (diff)
downloadfastd-3c83faaa1660a70932c14b0fb1f9175b531cdf10.tar
fastd-3c83faaa1660a70932c14b0fb1f9175b531cdf10.zip
Add sending of keep-alive packets
Diffstat (limited to 'src/protocol_null.c')
-rw-r--r--src/protocol_null.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/protocol_null.c b/src/protocol_null.c
index 163d164..cc08877 100644
--- a/src/protocol_null.c
+++ b/src/protocol_null.c
@@ -71,6 +71,8 @@ static void establish(fastd_context *ctx, fastd_peer *peer) {
else {
fastd_peer_set_established(ctx, peer);
}
+
+ fastd_task_schedule_keepalive(ctx, peer, ctx->conf->keepalive_interval*1000);
}
static void protocol_handshake_handle(fastd_context *ctx, fastd_peer *peer, const fastd_handshake *handshake) {
@@ -101,10 +103,13 @@ static void protocol_handshake_handle(fastd_context *ctx, fastd_peer *peer, cons
static void protocol_handle_recv(fastd_context *ctx, fastd_peer *peer, fastd_buffer buffer) {
if (fastd_peer_is_established(peer) && buffer.len) {
/* this could be optimized a bit */
- fastd_peer_clean_handshakes(ctx, peer);
+ fastd_task_delete_peer_handshakes(ctx, peer);
fastd_peer_seen(ctx, peer);
fastd_task_put_handle_recv(ctx, peer, buffer);
+
+ fastd_task_delete_peer_keepalives(ctx, peer);
+ fastd_task_schedule_keepalive(ctx, peer, ctx->conf->keepalive_interval*1000);
}
else {
fastd_buffer_free(buffer);