]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/Message.cc
Removed assert(!theInitiator) from the destructor because that assertion fails
[thirdparty/squid.git] / src / adaptation / Message.cc
CommitLineData
cb255235
AR
1/*
2 * DEBUG: section XXX
3 */
4
5#include "squid.h"
6#include "HttpMsg.h"
7#include "TextException.h"
8#include "adaptation/Message.h"
9
10Adaptation::Message::Message(): header(NULL)
11{
12}
13
14Adaptation::Message::Message(Header *aHeader): header(NULL)
15{
16 set(aHeader);
17}
18
19Adaptation::Message::~Message()
20{
21 clear();
22}
23
24void
25Adaptation::Message::clear()
26{
27 HTTPMSGUNLOCK(header);
28 body_pipe = NULL;
29}
30
31void
32Adaptation::Message::set(Header *aHeader)
33{
34 clear();
35 if (aHeader) {
36 header = HTTPMSGLOCK(aHeader);
37 body_pipe = header->body_pipe;
38 }
39}
40
41void
42Adaptation::Message::copyTo(Message &dest)
43{
44 Must(!dest.body_pipe); // can relax if needed, but need !body_pipe->used()
45 dest.clear();
46 if (header) {
47 if (header->body_pipe != NULL) {
48 // check that it would not be too late to clone the pipe
49 Must(!header->body_pipe->consumedSize());
50 header->body_pipe->clearConsumer(); // if any
51 // note: current header->body_pipe producer may later become
52 // dest.body_pipe consumer and consume its own data
53 // TODO: consumer should detect and short-circuit no-op adaptation
54 }
55 Header *copy = header->clone();
56 dest.set(copy);
57 }
58}