}
}
- if (state->d_state == IncomingTCPConnectionState::State::readingProxyProtocolHeader) {
+ if (!wouldBlock && state->d_state == IncomingTCPConnectionState::State::readingProxyProtocolHeader) {
DEBUGLOG("reading proxy protocol header");
do {
iostate = state->d_handler.tryRead(state->d_buffer, state->d_currentPos, state->d_proxyProtocolNeed);
while (!wouldBlock);
}
- if (state->d_state == IncomingTCPConnectionState::State::readingQuerySize) {
+ if (!wouldBlock && state->d_state == IncomingTCPConnectionState::State::readingQuerySize) {
DEBUGLOG("reading query size");
iostate = state->d_handler.tryRead(state->d_buffer, state->d_currentPos, sizeof(uint16_t));
if (iostate == IOState::Done) {
}
}
- if (state->d_state == IncomingTCPConnectionState::State::readingQuery) {
+ if (!wouldBlock && state->d_state == IncomingTCPConnectionState::State::readingQuery) {
DEBUGLOG("reading query");
iostate = state->d_handler.tryRead(state->d_buffer, state->d_currentPos, state->d_querySize);
if (iostate == IOState::Done) {
ioGuard.release();
state->d_state = IncomingTCPConnectionState::State::idle;
iostate = sendResponse(state, now, std::move(resp));
+ if (iostate != IOState::Done) {
+ wouldBlock = true;
+ }
}
}
+ else if (iostate != IOState::Done) {
+ wouldBlock = true;
+ }
}
else {
wouldBlock = true;
}
}
- if (state->d_state == IncomingTCPConnectionState::State::sendingResponse) {
+ if (!wouldBlock && state->d_state == IncomingTCPConnectionState::State::sendingResponse) {
DEBUGLOG("sending response");
iostate = state->d_handler.tryWrite(state->d_currentResponse.d_buffer, state->d_currentPos, state->d_currentResponse.d_buffer.size());
if (iostate == IOState::Done) {