Pipeline.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /*
10  * DEBUG: section 33 Client Request Pipeline
11  */
12 #include "squid.h"
13 #include "anyp/PortCfg.h"
14 #include "client_side.h"
15 #include "Debug.h"
16 #include "http/Stream.h"
17 #include "Pipeline.h"
18 
19 void
21 {
22  requests.push_back(c);
23  ++nrequests;
24  debugs(33, 3, "Pipeline " << (void*)this << " add request " << nrequests << ' ' << c);
25 }
26 
29 {
30  if (requests.empty()) {
31  debugs(33, 3, "Pipeline " << (void*)this << " empty");
32  return Http::StreamPointer();
33  }
34 
35  debugs(33, 3, "Pipeline " << (void*)this << " front " << requests.front());
36  return requests.front();
37 }
38 
41 {
42  if (requests.empty()) {
43  debugs(33, 3, "Pipeline " << (void*)this << " empty");
44  return Http::StreamPointer();
45  }
46 
47  debugs(33, 3, "Pipeline " << (void*)this << " back " << requests.back());
48  return requests.back();
49 }
50 
51 void
53 {
54  while (!requests.empty()) {
55  Http::StreamPointer context = requests.front();
56  debugs(33, 3, "Pipeline " << (void*)this << " notify(" << xerrno << ") " << context);
57  context->noteIoError(xerrno);
58  context->finished(); // cleanup and self-deregister
59  assert(context != requests.front());
60  }
61 }
62 
63 void
65 {
66  if (requests.empty())
67  return;
68 
69  debugs(33, 3, "Pipeline " << (void*)this << " drop " << requests.front());
70  // in reality there may be multiple contexts doing processing in parallel.
71  // XXX: pipeline still assumes HTTP/1 FIFO semantics are obeyed.
72  assert(which == requests.front());
73  requests.pop_front();
74 }
75 
std::list< Http::StreamPointer > requests
requests parsed from the connection but not yet completed.
Definition: Pipeline.h:70
#define assert(EX)
Definition: assert.h:17
Http::StreamPointer front() const
get the first request context in the pipeline
Definition: Pipeline.cc:28
void terminateAll(const int xerrno)
tell everybody about the err, and abort all waiting requests
Definition: Pipeline.cc:52
Http::StreamPointer back() const
get the last request context in the pipeline
Definition: Pipeline.cc:40
RefCount< Http::Stream > StreamPointer
Definition: forward.h:20
void add(const Http::StreamPointer &)
register a new request context to the pipeline
Definition: Pipeline.cc:20
void popMe(const Http::StreamPointer &)
deregister the front request from the pipeline
Definition: Pipeline.cc:64
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
uint32_t nrequests
Definition: Pipeline.h:66

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors