/**** PUBLIC INTERFACE ********************************************************/
FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRequest * r, const AccessLogEntryPointer &alp):
- al(alp)
+ entry(e),
+ request(r),
+ al(alp),
+ err(NULL),
+ clientConn(client),
+ start_t(squid_curtime),
+ n_tries(0),
+ pconnRace(raceImpossible)
{
- debugs(17, 2, HERE << "Forwarding client request " << client << ", url=" << e->url() );
- entry = e;
- clientConn = client;
- request = r;
+ debugs(17, 2, "Forwarding client request " << client << ", url=" << e->url());
HTTPMSGLOCK(request);
- pconnRace = raceImpossible;
- start_t = squid_curtime;
serverDestinations.reserve(Config.forward_max_tries);
e->lock("FwdState");
EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
+ flags.connected_okay = false;
+ flags.dont_retry = false;
+ flags.forward_completed = false;
+ debugs(17, 3, "FwdState constructed, this=" << this);
}
// Called once, right after object creation, when it is safe to set self
FwdState::~FwdState()
{
- debugs(17, 3, HERE << "FwdState destructor starting");
+ debugs(17, 3, "FwdState destructor start");
if (! flags.forward_completed)
completed();
serverDestinations.clear();
- debugs(17, 3, HERE << "FwdState destructor done");
+ debugs(17, 3, "FwdState destructed, this=" << this);
}
/**
#endif
}
-MemObject::MemObject(): smpCollapsed(false)
+MemObject::MemObject() :
+ inmem_lo(0),
+ nclients(0),
+ smpCollapsed(false),
+ request(NULL),
+ ping_reply_callback(NULL),
+ ircb_data(NULL),
+ id(0),
+ object_sz(-1),
+ swap_hdr_sz(0),
+#if URL_CHECKSUM_DEBUG
+ chksum(0),
+#endif
+ vary_headers(NULL)
{
- debugs(20, 3, HERE << "new MemObject " << this);
+ debugs(20, 3, "new MemObject " << this);
+ memset(&start_ping, 0, sizeof(start_ping));
+ memset(&abort, 0, sizeof(abort));
_reply = new HttpReply;
HTTPMSGLOCK(_reply);
-
- object_sz = -1;
-
- /* XXX account log_url */
-
- swapout.decision = SwapOut::swNeedsCheck;
}
MemObject::~MemObject()
{
- debugs(20, 3, HERE << "del MemObject " << this);
+ debugs(20, 3, "del MemObject " << this);
const Ctx ctx = ctx_enter(hasUris() ? urlXXX() : "[unknown_ctx]");
#if URL_CHECKSUM_DEBUG
class SwapOut
{
-
public:
+ SwapOut() : queue_offset(0), decision(swNeedsCheck) {}
+
int64_t queue_offset; ///< number of bytes sent to SwapDir for writing
StoreIOState::Pointer sio;
}
StatHist::StatHist(const StatHist &src) :
- capacity_(src.capacity_), min_(src.min_), max_(src.max_),
- scale_(src.scale_), val_in(src.val_in), val_out(src.val_out)
+ bins(NULL),
+ capacity_(src.capacity_),
+ min_(src.min_),
+ max_(src.max_),
+ scale_(src.scale_),
+ val_in(src.val_in),
+ val_out(src.val_out)
{
if (src.bins!=NULL) {
bins = static_cast<bins_type *>(xcalloc(src.capacity_, sizeof(bins_type)));
unsigned int
StatHist::findBin(double v)
{
-
v -= min_; /* offset */
if (v <= 0.0) /* too small */
assert(0);
}
-StoreIOState::StoreIOState() :
- swap_dirn(-1), swap_filen(-1), e(NULL), mode(O_BINARY),
- offset_(0), file_callback(NULL), callback(NULL), callback_data(NULL)
+StoreIOState::StoreIOState(StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data) :
+ swap_dirn(-1),
+ swap_filen(-1),
+ e(NULL),
+ mode(O_BINARY),
+ offset_(0),
+ file_callback(cbFile),
+ callback(cbIo),
+ callback_data(cbdataReference(data))
{
read.callback = NULL;
read.callback_data = NULL;
flags.closing = false;
}
-off_t
-StoreIOState::offset() const
-{
- return offset_;
-}
-
StoreIOState::~StoreIOState()
{
debugs(20,3, "StoreIOState::~StoreIOState: " << this);
/* StoreIOState does not get mempooled - it's children do */
void *operator new (size_t amount);
void operator delete (void *address);
- virtual ~StoreIOState();
- StoreIOState();
+ StoreIOState(StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data);
+ virtual ~StoreIOState();
- off_t offset() const;
+ off_t offset() const {return offset_;}
virtual void read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) = 0;
/** write the given buffer and free it when it is no longer needed
dst_rdns(NULL),
request(NULL),
reply(NULL),
-#if USE_AUTh
+#if USE_AUTH
auth_user_request(NULL),
#endif
#if SQUID_SNMP
#if USE_OPENSSL
sslErrors(NULL),
#endif
+ requestErrorType(ERR_MAX),
conn_(NULL),
fd_(-1),
destinationDomainChecked_(false),
ACLUserData::ACLUserData() : userDataNames(CaseSensitveSBufCompare)
{
+ flags.case_insensitive = false;
+ flags.required = false;
}
void
Adaptation::Icap::ServiceRep::ServiceRep(const ServiceConfigPointer &svcCfg):
AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(svcCfg),
+ sslContext(NULL),
#if USE_OPENSSL
sslSession(NULL),
#endif
cbdata() :
valid(0),
locks(0),
+ type(CBDATA_UNKNOWN),
#if USE_CBDATA_DEBUG
file(NULL),
line(0),
CBDATA_CLASS_INIT(clientStreamNode);
clientStreamNode::clientStreamNode(CSR * aReadfunc, CSCB * aCallback, CSD * aDetach, CSS * aStatus, ClientStreamData aData) :
+ head(NULL),
readfunc(aReadfunc),
callback(aCallback),
detach(aDetach),
HTTPMSGUNLOCK(reply);
}
-clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) : http (cbdataReference(clientContext)), old_entry (NULL), old_sc(NULL), deleting(false)
-{}
+clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) :
+ purgeStatus(Http::scNone),
+ lookingforstore(0),
+ http(cbdataReference(clientContext)),
+ headers_sz(-1),
+ sc(NULL),
+ old_reqsize(0),
+ reqsize(0),
+ reqofs(0),
+#if USE_CACHE_DIGESTS
+ lookup_type(NULL),
+#endif
+ ourNode(NULL),
+ reply(NULL),
+ old_entry(NULL),
+ old_sc(NULL),
+ deleting(false)
+{
+ *tempbuf = 0;
+}
/** Create an error in the store awaiting the client side to read it.
*
int old_reqsize; /* ... again, for the buffer */
size_t reqsize;
size_t reqofs;
- char tempbuf[HTTP_REQBUF_SZ]; /* a temporary buffer if we need working storage */
+ char tempbuf[HTTP_REQBUF_SZ]; ///< a temporary buffer if we need working storage
#if USE_CACHE_DIGESTS
const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */
#endif
- struct {
+ struct Flags {
+ Flags() : storelogiccomplete(0), complete(0), headersSent(false) {}
unsigned storelogiccomplete:1;
-
- unsigned complete:1; /* we have read all we can from upstream */
+ unsigned complete:1; ///< we have read all we can from upstream
bool headersSent;
} flags;
clientStreamNode *ourNode; /* This will go away if/when this file gets refactored some more */
cbdataReferenceDone(http);
delete error;
- debugs(85,3, HERE << this << " ClientRequestContext destructed");
+ debugs(85,3, "ClientRequestContext destructed, this=" << this);
}
-ClientRequestContext::ClientRequestContext(ClientHttpRequest *anHttp) : http(cbdataReference(anHttp)), acl_checklist (NULL), redirect_state (REDIRECT_NONE), store_id_state(REDIRECT_NONE),error(NULL), readNextRequest(false)
-{
- http_access_done = false;
- redirect_done = false;
- store_id_done = false;
- no_cache_done = false;
- interpreted_req_hdrs = false;
+ClientRequestContext::ClientRequestContext(ClientHttpRequest *anHttp) :
+ http(cbdataReference(anHttp)),
+ acl_checklist(NULL),
+ redirect_state(REDIRECT_NONE),
+ store_id_state(REDIRECT_NONE),
+ host_header_verify_done(false),
+ http_access_done(false),
+ adapted_http_access_done(false),
+#if USE_ADAPTATION
+ adaptation_acl_check_done(false),
+#endif
+ redirect_done(false),
+ store_id_done(false),
+ no_cache_done(false),
+ interpreted_req_hdrs(false),
+ tosToClientDone(false),
+ nfmarkToClientDone(false),
#if USE_OPENSSL
- sslBumpCheckDone = false;
+ sslBumpCheckDone(false),
#endif
- debugs(85,3, HERE << this << " ClientRequestContext constructed");
+ error(NULL),
+ readNextRequest(false)
+{
+ debugs(85, 3, "ClientRequestContext constructed, this=" << this);
}
CBDATA_CLASS_INIT(ClientHttpRequest);
#if USE_ADAPTATION
AsyncJob("ClientHttpRequest"),
#endif
- loggingEntry_(NULL)
+ request(NULL),
+ uri(NULL),
+ log_uri(NULL),
+ req_sz(0),
+ logType(LOG_TAG_NONE),
+ calloutContext(NULL),
+ maxReplyBodySize_(0),
+ entry_(NULL),
+ loggingEntry_(NULL),
+ conn_(NULL)
+#if USE_OPENSSL
+ , sslBumpNeed_(Ssl::bumpEnd)
+#endif
+#if USE_ADAPTATION
+ , request_satisfaction_mode(false)
+ , request_satisfaction_offset(0)
+#endif
{
setConn(aConn);
al = new AccessLogEntry;
}
#endif
dlinkAdd(this, &active, &ClientActiveRequests);
-#if USE_ADAPTATION
- request_satisfaction_mode = false;
-#endif
-#if USE_OPENSSL
- sslBumpNeed_ = Ssl::bumpEnd;
-#endif
}
/*
char *log_uri;
String store_id; /* StoreID for transactions where the request member is nil */
- struct {
+ struct Out {
+ Out() : offset(0), size(0), headers_sz(0) {}
+
int64_t offset;
int64_t size;
size_t headers_sz;
AccessLogEntry::Pointer al; ///< access.log entry
- struct {
+ struct Flags {
+ Flags() : accel(false), internal(false), done_copying(false), purging(false) {}
+
bool accel;
- //bool intercepted; //XXX: it's apparently never used.
- //bool spoof_client_ip; //XXX: it's apparently never used.
bool internal;
bool done_copying;
bool purging;
} flags;
- struct {
+ struct Redirect {
+ Redirect() : status(Http::scNone), location(NULL) {}
+
Http::StatusCode status;
char *location;
} redirect;
os << ')';
}
-ev_entry::ev_entry(char const * aName, EVH * aFunction, void * aArgument, double evWhen,
- int aWeight, bool haveArgument) : name(aName), func(aFunction),
- arg(haveArgument ? cbdataReference(aArgument) : aArgument), when(evWhen), weight(aWeight),
- cbdata(haveArgument)
+ev_entry::ev_entry(char const * aName, EVH * aFunction, void * aArgument, double evWhen, int aWeight, bool haveArg) :
+ name(aName),
+ func(aFunction),
+ arg(haveArg ? cbdataReference(aArgument) : aArgument),
+ when(evWhen),
+ weight(aWeight),
+ cbdata(haveArg),
+ next(NULL)
{
}
CBDATA_CLASS_INIT(external_acl);
external_acl::external_acl() :
+ next(NULL),
ttl(DEFAULT_EXTERNAL_ACL_TTL),
negative_ttl(-1),
grace(1),
StoreEntry *anEntry,
StoreIOState::STFNCB *cbFile,
StoreIOState::STIOCB *cbIo,
- void *data):
+ void *data) :
+ StoreIOState(cbFile, cbIo, data),
readableAnchor_(NULL),
writeableAnchor_(NULL),
sidCurrent(-1),
e = anEntry;
e->lock("rock I/O");
// anchor, swap_filen, and swap_dirn are set by the caller
- file_callback = cbFile;
- callback = cbIo;
- callback_data = cbdataReference(data);
++store_open_disk_fd; // TODO: use a dedicated counter?
//theFile is set by SwapDir because it depends on DiskIOStrategy
}
CBDATA_NAMESPACED_CLASS_INIT(Fs::Ufs,RebuildState);
Fs::Ufs::RebuildState::RebuildState(RefCount<UFSSwapDir> aSwapDir) :
- sd (aSwapDir), LogParser(NULL), e(NULL), fromLog(true), _done (false)
+ sd(aSwapDir),
+ n_read(0),
+ LogParser(NULL),
+ curlvl1(0),
+ curlvl2(0),
+ in_dir(0),
+ done(0),
+ fn(0),
+ entry(NULL),
+ td(NULL),
+ e(NULL),
+ fromLog(true),
+ _done(false),
+ cbdata(NULL)
{
+ *fullpath = 0;
+ *fullfilename = 0;
+
/*
* If the swap.state file exists in the cache_dir, then
* we'll use commonUfsDirRebuildFromSwapLog(), otherwise we'll
fd = -1;
if (!flags.init) { /* initialize, open first file */
+ // XXX: 0's should not be needed, constructor inits now
done = 0;
curlvl1 = 0;
curlvl2 = 0;
CBDATA_NAMESPACED_CLASS_INIT(Fs::Ufs,StoreSearchUFS);
Fs::Ufs::StoreSearchUFS::StoreSearchUFS(RefCount<UFSSwapDir> aSwapDir) :
- sd(aSwapDir), walker (sd->repl->WalkInit(sd->repl)),
- current (NULL), _done (false)
+ sd(aSwapDir),
+ walker(sd->repl->WalkInit(sd->repl)),
+ cbdata(NULL),
+ current(NULL),
+ _done(false)
{}
Fs::Ufs::StoreSearchUFS::~StoreSearchUFS()
/* ============= THE REAL UFS CODE ================ */
-Fs::Ufs::UFSStoreState::UFSStoreState(SwapDir * SD, StoreEntry * anEntry, STIOCB * callback_, void *callback_data_) : opening (false), creating (false), closing (false), reading(false), writing(false), pending_reads(NULL), pending_writes (NULL)
+Fs::Ufs::UFSStoreState::UFSStoreState(SwapDir * SD, StoreEntry * anEntry, STIOCB * cbIo, void *data) :
+ StoreIOState(NULL, cbIo, data),
+ opening(false),
+ creating(false),
+ closing(false),
+ reading(false),
+ writing(false),
+ pending_reads(NULL),
+ pending_writes(NULL),
+ read_buf(NULL)
{
+ // StoreIOState inherited members
swap_filen = anEntry->swap_filen;
swap_dirn = SD->index;
- mode = O_BINARY;
- callback = callback_;
- callback_data = cbdataReference(callback_data_);
e = anEntry;
+
+ // our flags
flags.write_draining = false;
flags.try_closing = false;
}
{
MEMPROXY_CLASS(UFSStoreState::_queued_read);
public:
+ _queued_read() : buf(NULL), size(0), offset(0), callback(NULL), callback_data(NULL) {}
+
char *buf;
size_t size;
off_t offset;
STRCB *callback;
void *callback_data;
-
};
class _queued_write
{
MEMPROXY_CLASS(UFSStoreState::_queued_write);
public:
+ _queued_write() : buf(NULL), size(0), offset(0), free_func(NULL) {}
+
char const *buf;
size_t size;
off_t offset;
FREE *free_func;
-
};
/** \todo These should be in the IO strategy */
CBDATA_CLASS(acl_tos);
public:
- acl_tos() : next(NULL), aclList(NULL) {}
+ acl_tos() : next(NULL), aclList(NULL), tos(0) {}
~acl_tos();
acl_tos *next;
CBDATA_CLASS(acl_nfmark);
public:
- acl_nfmark() : next(NULL), aclList(NULL) {}
+ acl_nfmark() : next(NULL), aclList(NULL), nfmark(0) {}
~acl_nfmark();
acl_nfmark *next;
parent_(thePool)
{
hash.key = xstrdup(key);
+ hash.next = NULL;
theList_ = new Comm::ConnectionPointer[capacity_];
// TODO: re-attach to MemPools. WAS: theList = (?? *)pconn_fds_pool->alloc();
}
Comm::ConnectionPointer clientConn; ///< TCP connection to the client
AsyncCall::Pointer callback; ///< we call this with the results
AsyncCall::Pointer closeHandler; ///< we call this when the connection closed
- time_t startTime; ///< when the peer connector negotiation started
bool splice; ///< whether we are going to splice or not
bool resumingSession; ///< whether it is an SSL resuming session connection
bool serverCertificateHandled; ///< whether handleServerCertificate() succeeded
storeClientCopy2(sc->entry, sc);
}
-store_client::store_client(StoreEntry *e) : entry (e)
-#if USE_DELAY_POOLS
- , delayId()
+store_client::store_client(StoreEntry *e) :
+ cmp_offset(0),
+#if STORE_CLIENT_LIST_DEBUG
+ owner(cbdataReference(data)),
#endif
- , type (e->storeClientType())
- , object_ok(true)
+ entry(e),
+ type(e->storeClientType()),
+ object_ok(true)
{
- cmp_offset = 0;
flags.disk_io_pending = false;
+ flags.store_copying = false;
+ flags.copy_event_pending = false;
++ entry->refcount;
- if (getType() == STORE_DISK_CLIENT)
+ if (getType() == STORE_DISK_CLIENT) {
/* assert we'll be able to get the data we want */
/* maybe we should open swapin_sio here */
assert(entry->swap_filen > -1 || entry->swappingOut());
-
-#if STORE_CLIENT_LIST_DEBUG
-
- owner = cbdataReference(data);
-
-#endif
+ }
}
store_client::~store_client()