More logging

This commit is contained in:
2022-07-03 22:11:21 -05:00
parent 111046e5d4
commit 8ecd79ff40

View File

@@ -386,13 +386,17 @@ int updateConnection(Connection *conn, Sitefile *site) {
unsigned long i; unsigned long i;
struct timespec currentTime; struct timespec currentTime;
const Port *port = site->ports + conn->portind; const Port *port = site->ports + conn->portind;
if (clock_gettime(CLOCK_MONOTONIC, &currentTime) < 0) if (clock_gettime(CLOCK_MONOTONIC, &currentTime) < 0) {
return 1; createLog("Error getting current time");
if (port->timeout > 0 &&
diff(&conn->lastdata, &currentTime) > port->timeout) {
return 1; return 1;
} }
received = recvStream(conn->stream, buff, sizeof(buff)); if (port->timeout > 0 &&
diff(&conn->lastdata, &currentTime) > port->timeout) {
createLog("Connection timed out");
return 1;
}
createFormatLog("Attempting to receive %ld bytes", sizeof buff);
received = recvStream(conn->stream, buff, sizeof buff);
createFormatLog("Received %ld bytes", received); createFormatLog("Received %ld bytes", received);
if (received < 0) if (received < 0)
return errno != EAGAIN && totalReceived <= 0; return errno != EAGAIN && totalReceived <= 0;