* data, or sending it.
*
\par
- * ClientKeepAliveNextRequest will then detect the presence of data in
+ * ConnStateData::kick() will then detect the presence of data in
* the next ClientHttpRequest, and will send it, restablishing the
* data flow.
*/
*/
}
-/// called when we have successfully finished writing the response
-void
-ClientSocketContext::keepaliveNextRequest()
-{
- debugs(33, 3, "ConnnStateData(" << http->getConn()->clientConnection << "), Context(" << clientConnection << ")");
-
- // mark ourselves as completed
- connIsFinished();
-}
-
void
ConnStateData::kick()
{
+ if (!Comm::IsConnOpen(clientConnection)) {
+ debugs(33, 2, clientConnection << " Connection was closed");
+ return;
+ }
+
if (pinning.pinned && !Comm::IsConnOpen(pinning.serverConnection)) {
debugs(33, 2, clientConnection << " Connection was pinned but server side gone. Terminating client connection");
clientConnection->close();
void
ClientSocketContext::initiateClose(const char *reason)
{
+ debugs(33, 4, clientConnection << " because " << reason);
http->getConn()->stopSending(reason); // closes ASAP
}
case STREAM_COMPLETE:
debugs(33, 5, conn << " Stream complete, keepalive is " << http->request->flags.proxyKeepalive);
- if (http->request->flags.proxyKeepalive)
- keepaliveNextRequest();
- else
- initiateClose("STREAM_COMPLETE NOKEEPALIVE");
+ if (!http->request->flags.proxyKeepalive)
+ clientConnection->close();
+ connIsFinished();
return;
case STREAM_UNPLANNED_COMPLETE:
pinning.serverConnection->close();
// If we are still sending data to the client, do not close now. When we are done sending,
- // ClientSocketContext::keepaliveNextRequest() checks pinning.serverConnection and will close.
+ // ConnStateData::kick() checks pinning.serverConnection and will close.
// However, if we are idle, then we must close to inform the idle client and minimize races.
if (clientIsIdle && clientConnection != NULL)
clientConnection->close();
//ClientSocketContext::~ClientSocketContext() STUB
bool ClientSocketContext::startOfOutput() const STUB_RETVAL(false)
void ClientSocketContext::writeComplete(const Comm::ConnectionPointer &conn, char *bufnotused, size_t size, Comm::Flag errflag) STUB
-void ClientSocketContext::keepaliveNextRequest() STUB
void ClientSocketContext::pullData() STUB
int64_t ClientSocketContext::getNextRangeOffset() const STUB_RETVAL(0)
bool ClientSocketContext::canPackMoreRanges() const STUB_RETVAL(false)