vtc: defuse assertion while stopping

The disconnect function should not complain when the server is already
closed by an explicit close.

Saw this failure in vtest:

*    top   TEST ../../../../bin/varnishtest/tests/r01918.vtc starting
...
**   s1    === txresp -nolen -bodylen 10
**** s1    txresp|HTTP/1.1 200 OK\r
**** s1    txresp|\r
**** s1    txresp|!"#$%&'()
**   s1    === close
...
**   s1    Waiting for server (4/-1)
**** s1    Closed
***  s1    shutting fd -1
---- s1    Shutdown failed: Bad file descriptor
parent 87771b9b
......@@ -265,7 +265,7 @@ server_disc(void *priv, struct vtclog *vl, int *fdp)
CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC);
vtc_log(vl, 3, "shutting fd %d", *fdp);
j = shutdown(*fdp, SHUT_WR);
if (!VTCP_Check(j))
if (!vtc_stop && !VTCP_Check(j))
vtc_fatal(vl, "Shutdown failed: %s", strerror(errno));
VTCP_close(fdp);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment