blob: 0722d0f4cd33182a5ea9553d15dea431b56b6e43 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 * Server management functions.
3 *
4 * Copyright 2000-2006 Willy Tarreau <w@1wt.eu>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <stdlib.h>
14#include <haproxy/memory.h>
15
16#include <types/backend.h>
17#include <types/capture.h>
18#include <types/log.h>
19#include <types/proxy.h>
20#include <types/server.h>
21
22#include <proto/session.h>
23#include <proto/queue.h>
24
25
26void **pool_session = NULL;
27
28/*
29 * frees the context associated to a session. It must have been removed first.
30 */
31void session_free(struct session *s)
32{
33 if (s->pend_pos)
34 pendconn_free(s->pend_pos);
35 if (s->req)
36 pool_free(buffer, s->req);
37 if (s->rep)
38 pool_free(buffer, s->rep);
39
40 if (s->rsp_cap != NULL) {
41 struct cap_hdr *h;
42 for (h = s->proxy->rsp_cap; h; h = h->next) {
43 if (s->rsp_cap[h->index] != NULL)
44 pool_free_to(h->pool, s->rsp_cap[h->index]);
45 }
46 pool_free_to(s->proxy->rsp_cap_pool, s->rsp_cap);
47 }
48 if (s->req_cap != NULL) {
49 struct cap_hdr *h;
50 for (h = s->proxy->req_cap; h; h = h->next) {
51 if (s->req_cap[h->index] != NULL)
52 pool_free_to(h->pool, s->req_cap[h->index]);
53 }
54 pool_free_to(s->proxy->req_cap_pool, s->req_cap);
55 }
56
57 if (s->logs.uri)
58 pool_free(requri, s->logs.uri);
59 if (s->logs.cli_cookie)
60 pool_free(capture, s->logs.cli_cookie);
61 if (s->logs.srv_cookie)
62 pool_free(capture, s->logs.srv_cookie);
63
64 pool_free(session, s);
65}
66
67
68/*
69 * Local variables:
70 * c-indent-level: 8
71 * c-basic-offset: 8
72 * End:
73 */