blob: 9a59e2858d30b93d8ae346405bbe61d861e71992 [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>
Willy Tarreaue3ba5f02006-06-29 18:54:54 +020014
15#include <common/config.h>
Willy Tarreau2dd0d472006-06-29 17:53:05 +020016#include <common/memory.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020017
18#include <types/backend.h>
19#include <types/capture.h>
20#include <types/log.h>
21#include <types/proxy.h>
22#include <types/server.h>
23
24#include <proto/session.h>
25#include <proto/queue.h>
26
27
28void **pool_session = NULL;
29
30/*
31 * frees the context associated to a session. It must have been removed first.
32 */
33void session_free(struct session *s)
34{
35 if (s->pend_pos)
36 pendconn_free(s->pend_pos);
37 if (s->req)
38 pool_free(buffer, s->req);
39 if (s->rep)
40 pool_free(buffer, s->rep);
41
42 if (s->rsp_cap != NULL) {
43 struct cap_hdr *h;
44 for (h = s->proxy->rsp_cap; h; h = h->next) {
45 if (s->rsp_cap[h->index] != NULL)
46 pool_free_to(h->pool, s->rsp_cap[h->index]);
47 }
48 pool_free_to(s->proxy->rsp_cap_pool, s->rsp_cap);
49 }
50 if (s->req_cap != NULL) {
51 struct cap_hdr *h;
52 for (h = s->proxy->req_cap; h; h = h->next) {
53 if (s->req_cap[h->index] != NULL)
54 pool_free_to(h->pool, s->req_cap[h->index]);
55 }
56 pool_free_to(s->proxy->req_cap_pool, s->req_cap);
57 }
58
59 if (s->logs.uri)
60 pool_free(requri, s->logs.uri);
61 if (s->logs.cli_cookie)
62 pool_free(capture, s->logs.cli_cookie);
63 if (s->logs.srv_cookie)
64 pool_free(capture, s->logs.srv_cookie);
65
66 pool_free(session, s);
67}
68
69
70/*
71 * Local variables:
72 * c-indent-level: 8
73 * c-basic-offset: 8
74 * End:
75 */