*/
uint64_t write_timeout;
+ /*
+ * Reading was throttled over TCP as the peer does not read the
+ * data we are sending back.
+ */
+ bool reading_throttled;
+
/*% outer socket is for 'wrapped' sockets - e.g. tcpdns in tcp */
isc_nmsocket_t *outer;
goto failure;
}
- result = isc__nm_start_reading(sock);
- if (result != ISC_R_SUCCESS) {
- goto failure;
+ if (!sock->reading_throttled) {
+ result = isc__nm_start_reading(sock);
+ if (result != ISC_R_SUCCESS) {
+ goto failure;
+ }
}
sock->reading = true;
"throttling TCP connection, the other side is "
"not reading the data (%zu)",
write_queue_size);
+ sock->reading_throttled = true;
isc__nm_stop_reading(sock);
}
} else if (uv_is_active(&sock->uv_handle.handle) &&
"is reading the data again (%zu)",
write_queue_size);
isc__nm_start_reading(sock);
+ sock->reading_throttled = false;
}
}
}
isc__nm_failed_send_cb(sock, uvreq, isc_uverr2result(status),
false);
if (!sock->client && sock->reading) {
+ /*
+ * As we are resuming reading, it is not throttled
+ * anymore (technically).
+ */
+ sock->reading_throttled = false;
isc__nm_start_reading(sock);
isc__nmsocket_reset(sock);
}