MCPcopy Create free account
hub / github.com/apache/httpd / connection_cleanup

Function connection_cleanup

modules/proxy/proxy_util.c:1648–1695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1646}
1647
1648static void connection_cleanup(void *theconn)
1649{
1650 proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
1651 proxy_worker *worker = conn->worker;
1652
1653 /* Sanity check: Did we already return the pooled connection? */
1654 if (conn->inreslist) {
1655 ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool, APLOGNO(00923)
1656 "Pooled connection 0x%pp for worker %s has been"
1657 " already returned to the connection pool.", conn,
1658 ap_proxy_worker_name(conn->pool, worker));
1659 return;
1660 }
1661
1662 if (conn->r) {
1663 apr_pool_destroy(conn->r->pool);
1664 conn->r = NULL;
1665 }
1666
1667 /* determine if the connection should be cleared, closed or reused */
1668 if (!worker->s->is_address_reusable) {
1669 apr_pool_t *p = conn->pool;
1670 apr_pool_clear(p);
1671 conn = connection_make(p, worker);
1672 }
1673 else if (!conn->sock
1674 || (conn->connection
1675 && conn->connection->keepalive == AP_CONN_CLOSE)
1676 || !ap_proxy_connection_reusable(conn)) {
1677 socket_cleanup(conn);
1678 }
1679 else if (conn->is_ssl) {
1680 /* The current ssl section/dir config of the conn is not necessarily
1681 * the one it will be reused for, so while the conn is in the reslist
1682 * reset its ssl config to the worker's, until a new user sets its own
1683 * ssl config eventually in proxy_connection_create() and so on.
1684 */
1685 ap_proxy_ssl_engine(conn->connection, worker->section_config, 1);
1686 }
1687
1688 if (worker->s->hmax && worker->cp->res) {
1689 conn->inreslist = 1;
1690 apr_reslist_release(worker->cp->res, (void *)conn);
1691 }
1692 else {
1693 worker->cp->conn = conn;
1694 }
1695}
1696
1697/* DEPRECATED */
1698PROXY_DECLARE(apr_status_t) ap_proxy_ssl_connection_cleanup(proxy_conn_rec *conn,

Callers 1

Calls 5

ap_proxy_worker_nameFunction · 0.85
connection_makeFunction · 0.85
socket_cleanupFunction · 0.85
ap_proxy_ssl_engineFunction · 0.85

Tested by

no test coverage detected