]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/helper/Request.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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.
9 #ifndef _SQUID_SRC_HELPER_REQUEST_H
10 #define _SQUID_SRC_HELPER_REQUEST_H
12 #include "helper/forward.h"
13 #include "time/gadgets.h"
20 MEMPROXY_CLASS(Helper::Request
);
23 Request(HLPCB
*c
, void *d
, const char *b
) :
24 buf(b
? xstrdup(b
) : nullptr),
26 data(cbdataReference(d
)),
27 placeholder(b
== nullptr),
31 memset(&dispatch_time
, 0, sizeof(dispatch_time
));
35 cbdataReferenceDone(data
);
43 int placeholder
; /* if 1, this is a dummy request waiting for a stateful helper to become available */
44 struct timeval dispatch_time
;
47 * A helper may configured to retry timed out requests or on BH replies.
48 * We attempt to recover by trying the lookup again, but limit the
49 * number of retries to prevent lag and lockups.
50 * This tracks the number of previous failures for the request.
53 bool timedOut(time_t timeout
) {return (squid_curtime
- dispatch_time
.tv_sec
) > timeout
;}
58 #endif /* _SQUID_SRC_HELPER_REQUEST_H */