GNU libmicrohttpd  0.9.72
connection_update_last_activity.c
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
24 #include "internal.h"
26 
27 
35 void
37 {
38  struct MHD_Daemon *daemon = connection->daemon;
39 
40  if (0 == connection->connection_timeout)
41  return; /* Skip update of activity for connections
42  without timeout timer. */
43  if (connection->suspended)
44  return; /* no activity on suspended connections */
45 
47  if (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_mode)
48  return; /* each connection has personal timeout */
49 
50  if (connection->connection_timeout != daemon->connection_default_timeout)
51  return; /* custom timeout, no need to move it in "normal" DLL */
52 
54  /* move connection to head of timeout list (by remove + add operation) */
56  daemon->normal_timeout_tail,
57  connection);
59  daemon->normal_timeout_tail,
60  connection);
62 }
63 
64 
65 /* end of connection_update_last_activity.c */
void MHD_connection_update_last_activity_(struct MHD_Connection *connection)
function to update last activity of a connection
#define XDLL_insert(head, tail, element)
Definition: internal.h:1786
#define XDLL_remove(head, tail, element)
Definition: internal.h:1806
#define MHD_mutex_unlock_chk_(pmutex)
Definition: mhd_locks.h:180
#define MHD_mutex_lock_chk_(pmutex)
Definition: mhd_locks.h:154
time_t MHD_monotonic_sec_counter(void)
internal shared structures
bool suspended
Definition: internal.h:764
time_t connection_timeout
Definition: internal.h:745
time_t last_activity
Definition: internal.h:739
struct MHD_Daemon * daemon
Definition: internal.h:675
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
time_t connection_default_timeout
Definition: internal.h:1371
struct MHD_Connection * normal_timeout_head
Definition: internal.h:1128
struct MHD_Connection * normal_timeout_tail
Definition: internal.h:1135
enum MHD_ThreadingMode threading_mode
Definition: internal.h:1417