Overview
| Artifact ID: | c77dd8ef35964be9a11d7c20a9118e554106989771ca9a2768a1d1e6e5cccb20 |
|---|---|
| Page Name: | checkin/8da6e3590a1ad6b194fe877474af1571404852afdd173ec4b7273b7bad6e04a7 |
| Date: | 2026-06-16 17:13:23 |
| Original User: | drh |
Content
A clone or sync over HTTP/HTTPS could block when the peer stopped sending without closing the connection. The client sat in a blocking read on the socket with no timeout. The trick was to fix it without breaking the TLS handshake.
http_socket.c: set SO_RCVTIMEO and SO_SNDTIMEO (30s) on the connection socket. The fd stays in blocking mode so the TLS handshake is unaffected.
http_ssl.c: when reads time out with SO_RCVTIMEO, there is no data and BIO_should_retry() is true. Count consecutive retries without progress in ssl_send()/ssl_receive() and give up after a few.