}
// pools connection if it is reusable or closes it
-void Adaptation::Icap::ServiceRep::putConnection(const Comm::ConnectionPointer &conn, bool isReusable, const char *comment)
+void Adaptation::Icap::ServiceRep::putConnection(const Comm::ConnectionPointer &conn, bool isReusable, bool sendReset, const char *comment)
{
Must(Comm::IsConnOpen(conn));
// do not pool an idle connection if we owe connections
commUnsetConnTimeout(conn);
theIdleConns->push(conn);
} else {
- debugs(93, 3, HERE << "closing pconn" << comment);
- // comm_close will clear timeout
- conn->close();
+ debugs(93, 3, HERE << (sendReset ? "RST" : "FIN") << "-closing " <<
+ comment);
+ // comm_close called from Connection::close will clear timeout
+ // TODO: add "bool sendReset = false" to Connection::close()?
+ if (sendReset)
+ comm_reset_close(conn);
+ else
+ conn->close();
}
Must(theBusyConns > 0);
bool allows204() const;
bool allows206() const;
Comm::ConnectionPointer getConnection(bool isRetriable, bool &isReused);
- void putConnection(const Comm::ConnectionPointer &conn, bool isReusable, const char *comment);
+ void putConnection(const Comm::ConnectionPointer &conn, bool isReusable, bool sendReset, const char *comment);
void noteConnectionUse(const Comm::ConnectionPointer &conn);
void noteConnectionFailed(const char *comment);
if (reuseConnection)
disableRetries();
+ const bool reset = !reuseConnection &&
+ (al.icap.outcome == xoGone || al.icap.outcome == xoError);
+
Adaptation::Icap::ServiceRep &s = service();
- s.putConnection(connection, reuseConnection, status());
+ s.putConnection(connection, reuseConnection, reset, status());
writer = NULL;
reader = NULL;