quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 5dfc25167d748fa80072ec997da9bec596c7b6d6
parent c05e00039f6bbbdace5c76f8b60d5ca252b11576
Author: Anselm R Garbe <anselm@garbe.us>
Date:   Sat, 15 Aug 2009 22:25:22 +0100

another version, behaves better under stress
Diffstat:
Mquark.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/quark.c b/quark.c @@ -300,7 +300,6 @@ request(void) { void serve(int fd) { int result; - unsigned int timeout = 1; socklen_t salen; struct sockaddr sa; @@ -308,8 +307,8 @@ serve(int fd) { while(running) { if((cfd = accept(fd, &sa, &salen)) == -1) { /* el cheapo socket release */ - fprintf(stderr, "%s: cannot accept(), sleep %u seconds\n", tstamp(), timeout); - sleep(timeout++); + fprintf(stderr, "%s: cannot accept: %s, sleep a second...\n", tstamp(), strerror(errno)); + sleep(1); continue; } if(fork() == 0) { @@ -324,7 +323,6 @@ serve(int fd) { close(cfd); exit(EXIT_SUCCESS); } - timeout = 1; } fprintf(stdout, "%s: shutting down\n", tstamp()); }