{
auto* conn = static_cast<IncomingHTTP2Connection*>(user_data);
- if (error_code == 0) {
- return 0;
- }
-
- auto stream = conn->d_currentStreams.find(stream_id);
- if (stream == conn->d_currentStreams.end()) {
- /* we don't care, then */
- return 0;
- }
-
- struct timeval now
- {
- };
- gettimeofday(&now, nullptr);
- auto request = std::move(stream->second);
- conn->d_currentStreams.erase(stream->first);
-
+ conn->d_currentStreams.erase(stream_id);
return 0;
}
conn->writeToSocket(true);
}
-bool IncomingHTTP2Connection::isIdle() const
-{
- return getConcurrentStreamsCount() == 0;
-}
-
void IncomingHTTP2Connection::stopIO()
{
d_ioState->reset();
gettimeofday(&now, nullptr);
if (newState == IOState::NeedRead) {
- if (isIdle()) {
+ /* use the idle TTL if the handshake has been completed (and proxy protocol payload received, if any),
+ and we have processed at least one query, otherwise we use the shorter read TTL */
+ if ((d_state == State::waitingForQuery || d_state == State::idle) && (d_queriesCount > 0 || d_currentQueriesCount)) {
ttd = getIdleClientReadTTD(now);
}
else {
std::unique_ptr<DOHUnitInterface> getDOHUnit(uint32_t streamID) override;
void stopIO();
- bool isIdle() const;
uint32_t getConcurrentStreamsCount() const;
void updateIO(IOState newState, const FDMultiplexer::callbackfunc_t& callback);
void handleIOError();