]> err.no Git - varnish/commitdiff
Close servers TCP connection more gracefully for EOF handling.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 26 Jun 2008 22:12:23 +0000 (22:12 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 26 Jun 2008 22:12:23 +0000 (22:12 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2839 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc_server.c

index 02373ce55b4ef521d1699adc6b377cfadb449cfb..bb62570b338f749c6887a63295d3f9b53113d5d3 100644 (file)
@@ -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");