HappyConnOpenerPointer connOpener; ///< current connection opening job
ResolvedPeersPointer destinations; ///< paths for forwarding the request
bool destinationsFound; ///< At least one candidate path found
+ // TODO: remove after fixing deferred reads in TunnelStateData::copyRead()
+ CodeContext::Pointer codeContext; ///< our creator context
// AsyncCalls which we set and may need cancelling.
struct {
startTime(squid_curtime),
waitingForConnectExchange(false),
destinations(new ResolvedPeers()),
- destinationsFound(false)
+ destinationsFound(false),
+ codeContext(CodeContext::Current())
{
debugs(26, 3, "TunnelStateData constructed this=" << this);
client.readPendingFunc = &tunnelDelayedClientRead;
return;
TunnelStateData *tunnel = static_cast<TunnelStateData*>(data);
+ const auto savedContext = CodeContext::Current();
+ CodeContext::Reset(tunnel->codeContext);
tunnel->client.readPending = NULL;
static uint64_t counter=0;
debugs(26, 7, "Client read(2) delayed " << ++counter << " times");
tunnel->copyRead(tunnel->client, TunnelStateData::ReadClient);
+ CodeContext::Reset(savedContext);
}
static void
return;
TunnelStateData *tunnel = static_cast<TunnelStateData*>(data);
+ const auto savedContext = CodeContext::Current();
+ CodeContext::Reset(tunnel->codeContext);
tunnel->server.readPending = NULL;
static uint64_t counter=0;
debugs(26, 7, "Server read(2) delayed " << ++counter << " times");
tunnel->copyRead(tunnel->server, TunnelStateData::ReadServer);
+ CodeContext::Reset(savedContext);
}
void
// then we schedule an event to try again in a few I/O cycles.
// Allow at least 1 byte to be read every (0.3*10) seconds.
int bw = from.bytesWanted(1, SQUID_TCP_SO_RCVBUF);
+ // XXX: Delay pools must not delay client-to-Squid traffic (i.e. when
+ // from.readPendingFunc is tunnelDelayedClientRead()).
+ // XXX: Bug #4913: Use DeferredRead instead.
if (bw == 1 && ++from.delayedLoops < 10) {
from.readPending = this;
eventAdd("tunnelDelayedServerRead", from.readPendingFunc, from.readPending, 0.3, true);