From ed43472ac9ac9f15df267d7574c3148be24b4c69 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Tue, 28 Jan 2014 08:35:18 +0100 Subject: [PATCH] print info when a UDP connection is rejected due to time. --- src/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 99a72fce..39264575 100644 --- a/src/main.c +++ b/src/main.c @@ -658,15 +658,19 @@ time_t now; list_for_each(&s->proc_list.head, ctmp, list) { if (session_id_size == ctmp->dtls_session_id_size && - memcmp(session_id, ctmp->dtls_session_id, session_id_size) == 0 && - (now - ctmp->udp_fd_receive_time > UDP_FD_RESEND_TIME)) { + memcmp(session_id, ctmp->dtls_session_id, session_id_size) == 0) { UdpFdMsg msg = UDP_FD_MSG__INIT; + if (now - ctmp->udp_fd_receive_time <= UDP_FD_RESEND_TIME) { + mslog(s, ctmp, LOG_INFO, "received UDP connection too soon"); + break; + } + ret = connect(listener->fd, (void*)&cli_addr, cli_addr_size); if (ret == -1) { e = errno; mslog(s, ctmp, LOG_ERR, "connect UDP socket: %s", strerror(e)); - return -1; + break; } ret = send_socket_msg_to_worker(s, ctmp, CMD_UDP_FD, @@ -676,7 +680,7 @@ time_t now; (pack_func)udp_fd_msg__pack); if (ret < 0) { mslog(s, ctmp, LOG_ERR, "error passing UDP socket"); - return -1; + break; } mslog(s, ctmp, LOG_DEBUG, "passed UDP socket"); ctmp->udp_fd_receive_time = now;