When changed too early and client socket is paused,
then packet will processed again when socket is woken
up and expect_rfq_count will be too high.
static bool handle_client_work(PgSocket *client, PktHdr *pkt)
{
SBuf *sbuf = &client->sbuf;
+ int rfq_delta = 0;
switch (pkt->type) {
/* request immediate response from server */
case 'S': /* Sync */
- client->expect_rfq_count++;
+ rfq_delta++;
break;
case 'H': /* Flush */
break;
if (!find_server(client))
return false;
+ /* postpone rfq change until certain that client will not be paused */
+ if (rfq_delta) {
+ client->expect_rfq_count += rfq_delta;
+ }
+
client->pool->stats.client_bytes += pkt->len;
/* tag the server as dirty */