From 8e91e3a30535888b504c7cb8ecc517bc0db34448 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 16 Sep 2014 07:47:40 +0100 Subject: [PATCH] Timeout only non-listening connections --- mongoose.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mongoose.c b/mongoose.c index 732a5310..e32c63a9 100644 --- a/mongoose.c +++ b/mongoose.c @@ -15,7 +15,7 @@ // Alternatively, you can license this library under a commercial // license, as set out in . // -// $Date: 2014-09-15 12:48:55 UTC $ +// $Date: 2014-09-16 06:47:40 UTC $ #ifdef NOEMBED_NET_SKELETON #include "net_skeleton.h" @@ -37,7 +37,7 @@ // Alternatively, you can license this software under a commercial // license, as set out in . // -// $Date: 2014-09-15 12:48:55 UTC $ +// $Date: 2014-09-16 06:47:40 UTC $ #ifndef NS_SKELETON_HEADER_INCLUDED #define NS_SKELETON_HEADER_INCLUDED @@ -276,7 +276,7 @@ int ns_resolve(const char *domain_name, char *ip_addr_buf, size_t buf_len); // Alternatively, you can license this software under a commercial // license, as set out in . // -// $Date: 2014-09-15 12:48:55 UTC $ +// $Date: 2014-09-16 06:47:40 UTC $ #ifndef NS_MALLOC @@ -5131,7 +5131,7 @@ static void mg_ev_handler(struct ns_connection *nc, enum ns_event ev, void *p) { ping_idle_websocket_connection(conn, current_time); } - if (nc->listener == NULL && + if (nc->listener != NULL && nc->last_io_time + MONGOOSE_IDLE_TIMEOUT_SECONDS < current_time) { mg_ev_handler(nc, NS_CLOSE, NULL); nc->flags |= NSF_CLOSE_IMMEDIATELY;