GNU libmicrohttpd  0.9.69
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 */
MHD_mutex_unlock_chk_
#define MHD_mutex_unlock_chk_(pmutex)
Definition: mhd_locks.h:180
MHD_connection_update_last_activity_
void MHD_connection_update_last_activity_(struct MHD_Connection *connection)
Definition: connection_update_last_activity.c:36
MHD_monotonic_sec_counter
time_t MHD_monotonic_sec_counter(void)
Definition: mhd_mono_clock.c:337
internal.h
internal shared structures
MHD_Daemon::normal_timeout_tail
struct MHD_Connection * normal_timeout_tail
Definition: internal.h:1135
MHD_Daemon::normal_timeout_head
struct MHD_Connection * normal_timeout_head
Definition: internal.h:1128
MHD_Connection::last_activity
time_t last_activity
Definition: internal.h:739
MHD_Connection::suspended
bool suspended
Definition: internal.h:764
MHD_Daemon::threading_mode
enum MHD_ThreadingMode threading_mode
Definition: internal.h:1417
MHD_Daemon::cleanup_connection_mutex
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
MHD_Daemon
Definition: internal.h:1000
connection_update_last_activity.h
function to update last activity of a connection
MHD_mutex_lock_chk_
#define MHD_mutex_lock_chk_(pmutex)
Definition: mhd_locks.h:154
XDLL_remove
#define XDLL_remove(head, tail, element)
Definition: internal.h:1806
MHD_Connection::daemon
struct MHD_Daemon * daemon
Definition: internal.h:675
MHD_Daemon::connection_default_timeout
time_t connection_default_timeout
Definition: internal.h:1371
XDLL_insert
#define XDLL_insert(head, tail, element)
Definition: internal.h:1786
MHD_Connection
Definition: internal.h:633
MHD_Connection::connection_timeout
time_t connection_timeout
Definition: internal.h:745