summaryrefslogtreecommitdiffstats
path: root/src/protocol_ec25519_fhmqvc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol_ec25519_fhmqvc.c')
-rw-r--r--src/protocol_ec25519_fhmqvc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/protocol_ec25519_fhmqvc.c b/src/protocol_ec25519_fhmqvc.c
index f2582f2..6ebb771 100644
--- a/src/protocol_ec25519_fhmqvc.c
+++ b/src/protocol_ec25519_fhmqvc.c
@@ -559,6 +559,11 @@ static void protocol_handshake_handle(fastd_context *ctx, fastd_socket *sock, co
fastd_peer *peer = get_peer(ctx, peer_conf);
+ if (!fastd_peer_may_connect(ctx, peer)) {
+ pr_debug(ctx, "ignoring handshake from %P[%I] because of local constraints", peer, address);
+ return;
+ }
+
if (backoff(ctx, peer)) {
pr_debug(ctx, "received repeated handshakes from %P[%I], ignoring", peer, address);
return;
@@ -726,7 +731,7 @@ static void session_send(fastd_context *ctx, fastd_peer *peer, fastd_buffer buff
}
static void protocol_send(fastd_context *ctx, fastd_peer *peer, fastd_buffer buffer) {
- if (!peer->protocol_state || !is_session_valid(ctx, &peer->protocol_state->session)) {
+ if (!peer->protocol_state || !fastd_peer_is_established(peer) || !is_session_valid(ctx, &peer->protocol_state->session)) {
fastd_buffer_free(buffer);
return;
}