diff options
| author | 2026-02-17 22:55:29 +0100 | |
|---|---|---|
| committer | 2026-02-17 22:55:29 +0100 | |
| commit | c29d691d32eea87b748587cc1f9c418a1bd1a00e (patch) | |
| tree | d1065280131c0e25b641c7ada53c24cb99f7af80 | |
| parent | Version 2.90 RELEASED. (diff) | |
| download | snac2-c29d691d32eea87b748587cc1f9c418a1bd1a00e.tar.gz snac2-c29d691d32eea87b748587cc1f9c418a1bd1a00e.tar.xz snac2-c29d691d32eea87b748587cc1f9c418a1bd1a00e.zip | |
httpd: Log xs_socket_accept failure reason
So far, it was expected that xs_socket_accept should work and while its
failure results in a termination, it was not properly logged. With this
change, an error message including the strerror message is being logged.
After experiencing some unexpected snac httpd shutdowns, I added a bit
of additional logging, including when xs_socket_accept fails. This
proved useful, as it unveiled a deeper error on my machine:
> xs_socket_accept failed: Too many open files
Since entering this code path results in termination, I thought
upstreaming this logging might be useful for others.
| -rw-r--r-- | httpd.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -1116,9 +1116,10 @@ void httpd(void) | |||
| 1116 | FILE *f = fdopen(cs, "r+"); | 1116 | FILE *f = fdopen(cs, "r+"); |
| 1117 | xs *job = xs_data_new(&f, sizeof(FILE *)); | 1117 | xs *job = xs_data_new(&f, sizeof(FILE *)); |
| 1118 | job_post(job, 1); | 1118 | job_post(job, 1); |
| 1119 | } | 1119 | } else { |
| 1120 | else | 1120 | srv_log(xs_fmt("error: xs_socket_accept failed: %s", strerror(errno))); |
| 1121 | break; | 1121 | break; |
| 1122 | } | ||
| 1122 | } | 1123 | } |
| 1123 | } | 1124 | } |
| 1124 | 1125 | ||