From: phk Date: Thu, 26 Jun 2008 22:12:23 +0000 (+0000) Subject: Close servers TCP connection more gracefully for EOF handling. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db74580a39de9c62d0e7a22cfb5c95d9fa519743;p=varnish Close servers TCP connection more gracefully for EOF handling. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2839 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/vtc_server.c b/varnish-cache/bin/varnishtest/vtc_server.c index 02373ce5..bb62570b 100644 --- a/varnish-cache/bin/varnishtest/vtc_server.c +++ b/varnish-cache/bin/varnishtest/vtc_server.c @@ -80,6 +80,7 @@ server_thread(void *priv) struct sockaddr_storage addr_s; struct sockaddr *addr; socklen_t l; + char c; CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC); @@ -96,6 +97,11 @@ server_thread(void *priv) fd = accept(s->sock, addr, &l); vtc_log(vl, 3, "Accepted socket fd is %d", fd); http_process(vl, s->spec, fd, 0); + vtc_log(vl, 3, "shutting fd %d", fd); + AZ(shutdown(fd, SHUT_WR)); + while (1 == read(fd, &c, 1)) + continue; + vtc_log(vl, 3, "closing fd %d", fd); AZ(close(fd)); } vtc_log(vl, 2, "Ending");