Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 2 | * include/proto/session.h |
| 3 | * This file defines everything related to sessions. |
| 4 | * |
| 5 | * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation, version 2.1 |
| 10 | * exclusively. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 21 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 22 | #ifndef _PROTO_SESSION_H |
| 23 | #define _PROTO_SESSION_H |
| 24 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 25 | #include <common/config.h> |
Willy Tarreau | c6ca1a0 | 2007-05-13 19:43:47 +0200 | [diff] [blame] | 26 | #include <common/memory.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 27 | #include <types/session.h> |
Willy Tarreau | 91c43d7 | 2010-06-20 11:19:22 +0200 | [diff] [blame] | 28 | #include <proto/freq_ctr.h> |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 29 | #include <proto/stick_table.h> |
Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 30 | |
Willy Tarreau | c6ca1a0 | 2007-05-13 19:43:47 +0200 | [diff] [blame] | 31 | extern struct pool_head *pool2_session; |
Willy Tarreau | f54f8bd | 2008-11-23 19:53:55 +0100 | [diff] [blame] | 32 | extern struct list sessions; |
Willy Tarreau | c6ca1a0 | 2007-05-13 19:43:47 +0200 | [diff] [blame] | 33 | |
Willy Tarreau | bc174aa | 2012-11-19 16:10:32 +0100 | [diff] [blame] | 34 | extern struct data_cb sess_conn_cb; |
| 35 | |
Willy Tarreau | 81f9aa3 | 2010-06-01 17:45:26 +0200 | [diff] [blame] | 36 | int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 37 | |
Willy Tarreau | c6ca1a0 | 2007-05-13 19:43:47 +0200 | [diff] [blame] | 38 | /* perform minimal intializations, report 0 in case of error, 1 if OK. */ |
| 39 | int init_session(); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 40 | |
Willy Tarreau | a2a64e9 | 2011-09-07 23:01:56 +0200 | [diff] [blame] | 41 | /* kill a session and set the termination flags to <why> (one of SN_ERR_*) */ |
| 42 | void session_shutdown(struct session *session, int why); |
Simon Horman | dec5be4 | 2011-06-08 09:19:07 +0900 | [diff] [blame] | 43 | |
Krzysztof Piotr Oledzki | 583bc96 | 2007-11-24 22:12:47 +0100 | [diff] [blame] | 44 | void session_process_counters(struct session *s); |
Willy Tarreau | 7c669d7 | 2008-06-20 15:04:11 +0200 | [diff] [blame] | 45 | void sess_change_server(struct session *sess, struct server *newsrv); |
Willy Tarreau | 26c2506 | 2009-03-08 09:38:41 +0100 | [diff] [blame] | 46 | struct task *process_session(struct task *t); |
Willy Tarreau | 8445533 | 2009-03-15 22:34:05 +0100 | [diff] [blame] | 47 | void default_srv_error(struct session *s, struct stream_interface *si); |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 48 | int parse_track_counters(char **args, int *arg, |
| 49 | int section_type, struct proxy *curpx, |
| 50 | struct track_ctr_prm *prm, |
Willy Tarreau | 0a3dd74 | 2012-05-08 19:47:01 +0200 | [diff] [blame] | 51 | struct proxy *defpx, char **err); |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 52 | |
Willy Tarreau | 787add2 | 2013-11-23 23:37:04 +0100 | [diff] [blame] | 53 | /* returns the session from a void *owner */ |
| 54 | static inline struct session *session_from_task(struct task *t) |
| 55 | { |
| 56 | return (struct session *)t->context; |
| 57 | } |
| 58 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 59 | /* sets the stick counter's entry pointer */ |
| 60 | static inline void stkctr_set_entry(struct stkctr *stkctr, struct stksess *entry) |
| 61 | { |
| 62 | stkctr->entry = caddr_from_ptr(entry, 0); |
| 63 | } |
| 64 | |
| 65 | /* returns the entry pointer from a stick counter */ |
| 66 | static inline struct stksess *stkctr_entry(struct stkctr *stkctr) |
| 67 | { |
| 68 | return caddr_to_ptr(stkctr->entry); |
| 69 | } |
| 70 | |
| 71 | /* returns the two flags from a stick counter */ |
| 72 | static inline unsigned int stkctr_flags(struct stkctr *stkctr) |
| 73 | { |
| 74 | return caddr_to_data(stkctr->entry); |
| 75 | } |
| 76 | |
| 77 | /* sets up to two flags at a time on a composite address */ |
| 78 | static inline void stkctr_set_flags(struct stkctr *stkctr, unsigned int flags) |
| 79 | { |
| 80 | stkctr->entry = caddr_set_flags(stkctr->entry, flags); |
| 81 | } |
| 82 | |
| 83 | /* returns the two flags from a stick counter */ |
| 84 | static inline void stkctr_clr_flags(struct stkctr *stkctr, unsigned int flags) |
| 85 | { |
| 86 | stkctr->entry = caddr_clr_flags(stkctr->entry, flags); |
| 87 | } |
| 88 | |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 89 | /* Remove the refcount from the session to the tracked counters, and clear the |
| 90 | * pointer to ensure this is only performed once. The caller is responsible for |
| 91 | * ensuring that the pointer is valid first. |
| 92 | */ |
| 93 | static inline void session_store_counters(struct session *s) |
| 94 | { |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 95 | void *ptr; |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 96 | int i; |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 97 | |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 98 | for (i = 0; i < MAX_SESS_STKCTR; i++) { |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 99 | if (!stkctr_entry(&s->stkctr[i])) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 100 | continue; |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 101 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_CONN_CUR); |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 102 | if (ptr) |
| 103 | stktable_data_cast(ptr, conn_cur)--; |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 104 | stkctr_entry(&s->stkctr[i])->ref_cnt--; |
| 105 | stksess_kill_if_expired(s->stkctr[i].table, stkctr_entry(&s->stkctr[i])); |
| 106 | stkctr_set_entry(&s->stkctr[i], NULL); |
Willy Tarreau | 38285c1 | 2010-06-18 16:35:43 +0200 | [diff] [blame] | 107 | } |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 108 | } |
| 109 | |
Willy Tarreau | f333834 | 2014-01-28 21:40:28 +0100 | [diff] [blame] | 110 | /* Remove the refcount from the session counters tracked at the content level if |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 111 | * any, and clear the pointer to ensure this is only performed once. The caller |
| 112 | * is responsible for ensuring that the pointer is valid first. |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 113 | */ |
Willy Tarreau | f333834 | 2014-01-28 21:40:28 +0100 | [diff] [blame] | 114 | static inline void session_stop_content_counters(struct session *s) |
Willy Tarreau | 9ba2dcc | 2010-06-14 21:04:55 +0200 | [diff] [blame] | 115 | { |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 116 | void *ptr; |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 117 | int i; |
Willy Tarreau | e348793 | 2010-06-18 21:03:20 +0200 | [diff] [blame] | 118 | |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 119 | for (i = 0; i < MAX_SESS_STKCTR; i++) { |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 120 | if (!stkctr_entry(&s->stkctr[i])) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 121 | continue; |
Willy Tarreau | 0a4838c | 2010-08-06 20:11:05 +0200 | [diff] [blame] | 122 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 123 | if (!(stkctr_flags(&s->stkctr[i]) & STKCTR_TRACK_CONTENT)) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 124 | continue; |
| 125 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 126 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_CONN_CUR); |
Willy Tarreau | 0a4838c | 2010-08-06 20:11:05 +0200 | [diff] [blame] | 127 | if (ptr) |
| 128 | stktable_data_cast(ptr, conn_cur)--; |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 129 | stkctr_entry(&s->stkctr[i])->ref_cnt--; |
| 130 | stksess_kill_if_expired(s->stkctr[i].table, stkctr_entry(&s->stkctr[i])); |
| 131 | stkctr_set_entry(&s->stkctr[i], NULL); |
Willy Tarreau | 0a4838c | 2010-08-06 20:11:05 +0200 | [diff] [blame] | 132 | } |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 133 | } |
Willy Tarreau | e348793 | 2010-06-18 21:03:20 +0200 | [diff] [blame] | 134 | |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 135 | /* Increase total and concurrent connection count for stick entry <ts> of table |
| 136 | * <t>. The caller is responsible for ensuring that <t> and <ts> are valid |
| 137 | * pointers, and for calling this only once per connection. |
| 138 | */ |
| 139 | static inline void session_start_counters(struct stktable *t, struct stksess *ts) |
| 140 | { |
| 141 | void *ptr; |
Willy Tarreau | 91c43d7 | 2010-06-20 11:19:22 +0200 | [diff] [blame] | 142 | |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 143 | ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR); |
| 144 | if (ptr) |
| 145 | stktable_data_cast(ptr, conn_cur)++; |
| 146 | |
| 147 | ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CNT); |
| 148 | if (ptr) |
| 149 | stktable_data_cast(ptr, conn_cnt)++; |
| 150 | |
| 151 | ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_RATE); |
| 152 | if (ptr) |
| 153 | update_freq_ctr_period(&stktable_data_cast(ptr, conn_rate), |
| 154 | t->data_arg[STKTABLE_DT_CONN_RATE].u, 1); |
| 155 | if (tick_isset(t->expire)) |
| 156 | ts->expire = tick_add(now_ms, MS_TO_TICKS(t->expire)); |
| 157 | } |
| 158 | |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 159 | /* Enable tracking of session counters as <stkctr> on stksess <ts>. The caller is |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 160 | * responsible for ensuring that <t> and <ts> are valid pointers. Some controls |
| 161 | * are performed to ensure the state can still change. |
| 162 | */ |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 163 | static inline void session_track_stkctr(struct stkctr *ctr, struct stktable *t, struct stksess *ts) |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 164 | { |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 165 | if (stkctr_entry(ctr)) |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 166 | return; |
| 167 | |
| 168 | ts->ref_cnt++; |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 169 | ctr->table = t; |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 170 | stkctr_set_entry(ctr, ts); |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 171 | session_start_counters(t, ts); |
| 172 | } |
| 173 | |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 174 | /* Increase the number of cumulated HTTP requests in the tracked counters */ |
| 175 | static void inline session_inc_http_req_ctr(struct session *s) |
| 176 | { |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 177 | void *ptr; |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 178 | int i; |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 179 | |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 180 | for (i = 0; i < MAX_SESS_STKCTR; i++) { |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 181 | if (!stkctr_entry(&s->stkctr[i])) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 182 | continue; |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 183 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 184 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_HTTP_REQ_CNT); |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 185 | if (ptr) |
| 186 | stktable_data_cast(ptr, http_req_cnt)++; |
| 187 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 188 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_HTTP_REQ_RATE); |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 189 | if (ptr) |
| 190 | update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate), |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 191 | s->stkctr[i].table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1); |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 192 | } |
| 193 | } |
| 194 | |
Willy Tarreau | 5d5b5d8 | 2012-12-09 12:00:04 +0100 | [diff] [blame] | 195 | /* Increase the number of cumulated HTTP requests in the backend's tracked counters */ |
| 196 | static void inline session_inc_be_http_req_ctr(struct session *s) |
| 197 | { |
| 198 | void *ptr; |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 199 | int i; |
Willy Tarreau | 5d5b5d8 | 2012-12-09 12:00:04 +0100 | [diff] [blame] | 200 | |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 201 | for (i = 0; i < MAX_SESS_STKCTR; i++) { |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 202 | if (!stkctr_entry(&s->stkctr[i])) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 203 | continue; |
Willy Tarreau | 5d5b5d8 | 2012-12-09 12:00:04 +0100 | [diff] [blame] | 204 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 205 | if (!(stkctr_flags(&s->stkctr[i]) & STKCTR_TRACK_BACKEND)) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 206 | continue; |
| 207 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 208 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_HTTP_REQ_CNT); |
Willy Tarreau | 5d5b5d8 | 2012-12-09 12:00:04 +0100 | [diff] [blame] | 209 | if (ptr) |
| 210 | stktable_data_cast(ptr, http_req_cnt)++; |
| 211 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 212 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_HTTP_REQ_RATE); |
Willy Tarreau | 5d5b5d8 | 2012-12-09 12:00:04 +0100 | [diff] [blame] | 213 | if (ptr) |
| 214 | update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate), |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 215 | s->stkctr[i].table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1); |
Willy Tarreau | 5d5b5d8 | 2012-12-09 12:00:04 +0100 | [diff] [blame] | 216 | } |
| 217 | } |
| 218 | |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 219 | /* Increase the number of cumulated failed HTTP requests in the tracked |
| 220 | * counters. Only 4xx requests should be counted here so that we can |
| 221 | * distinguish between errors caused by client behaviour and other ones. |
| 222 | * Note that even 404 are interesting because they're generally caused by |
| 223 | * vulnerability scans. |
| 224 | */ |
| 225 | static void inline session_inc_http_err_ctr(struct session *s) |
| 226 | { |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 227 | void *ptr; |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 228 | int i; |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 229 | |
Willy Tarreau | b4c8493 | 2013-07-23 19:15:30 +0200 | [diff] [blame] | 230 | for (i = 0; i < MAX_SESS_STKCTR; i++) { |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 231 | if (!stkctr_entry(&s->stkctr[i])) |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 232 | continue; |
Willy Tarreau | f059a0f | 2010-08-03 16:29:52 +0200 | [diff] [blame] | 233 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 234 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_HTTP_ERR_CNT); |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 235 | if (ptr) |
| 236 | stktable_data_cast(ptr, http_err_cnt)++; |
| 237 | |
Willy Tarreau | cc08d2c | 2014-01-28 23:18:23 +0100 | [diff] [blame] | 238 | ptr = stktable_data_ptr(s->stkctr[i].table, stkctr_entry(&s->stkctr[i]), STKTABLE_DT_HTTP_ERR_RATE); |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 239 | if (ptr) |
| 240 | update_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate), |
Willy Tarreau | 20d46a5 | 2012-12-09 15:55:40 +0100 | [diff] [blame] | 241 | s->stkctr[i].table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1); |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 242 | } |
| 243 | } |
| 244 | |
Simon Horman | af51495 | 2011-06-21 14:34:57 +0900 | [diff] [blame] | 245 | static void inline session_add_srv_conn(struct session *sess, struct server *srv) |
| 246 | { |
| 247 | sess->srv_conn = srv; |
| 248 | LIST_ADD(&srv->actconns, &sess->by_srv); |
| 249 | } |
| 250 | |
| 251 | static void inline session_del_srv_conn(struct session *sess) |
| 252 | { |
| 253 | if (!sess->srv_conn) |
| 254 | return; |
| 255 | |
| 256 | sess->srv_conn = NULL; |
| 257 | LIST_DEL(&sess->by_srv); |
| 258 | } |
| 259 | |
Willy Tarreau | 9bd0d74 | 2011-07-20 00:17:39 +0200 | [diff] [blame] | 260 | static void inline session_init_srv_conn(struct session *sess) |
| 261 | { |
| 262 | sess->srv_conn = NULL; |
| 263 | LIST_INIT(&sess->by_srv); |
| 264 | } |
| 265 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 266 | #endif /* _PROTO_SESSION_H */ |
Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 267 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 268 | /* |
| 269 | * Local variables: |
| 270 | * c-indent-level: 8 |
| 271 | * c-basic-offset: 8 |
| 272 | * End: |
| 273 | */ |