}
int Curl_cpool_init(struct cpool *cpool,
- Curl_cpool_disconnect_cb *disconnect_cb,
struct Curl_easy *idata,
struct Curl_share *share,
size_t size)
Curl_str_key_compare, cpool_bundle_free_entry);
DEBUGASSERT(idata);
- DEBUGASSERT(disconnect_cb);
- if(!disconnect_cb)
- return 1;
cpool->idata = idata;
- cpool->disconnect_cb = disconnect_cb;
cpool->share = share;
cpool->initialised = TRUE;
return 0; /* good */
cpool_bundle_add(bundle, conn);
conn->connection_id = cpool->next_connection_id++;
cpool->num_conn++;
- DEBUGF(infof(data, "Added connection %" FMT_OFF_T ". "
- "The cache now contains %zu members",
- conn->connection_id, cpool->num_conn));
+ CURL_TRC_M(data, "[CPOOL] added connection %" FMT_OFF_T ". "
+ "The cache now contains %zu members",
+ conn->connection_id, cpool->num_conn);
out:
CPOOL_UNLOCK(cpool, data);
DEBUGASSERT(!conn->bits.in_cpool);
}
- /* Run the callback to let it clean up anything it wants to. */
- aborted = cpool->disconnect_cb(data, conn, aborted);
+ /* treat the connection as aborted in CONNECT_ONLY situations,
+ * so no graceful shutdown is attempted. */
+ if(conn->connect_only)
+ aborted = TRUE;
if(data->multi) {
/* Add it to the multi's cpool for shutdown handling */
struct connectdata *conn,
bool aborted);
-/**
- * Callback invoked when disconnecting connections.
- * @param data transfer last handling the connection, not attached
- * @param conn the connection to discard
- * @param aborted if the connection is being aborted
- * @return if the connection is being aborted, e.g. should NOT perform
- * a shutdown and just close.
- **/
-typedef bool Curl_cpool_disconnect_cb(struct Curl_easy *data,
- struct connectdata *conn,
- bool aborted);
-
struct cpool {
/* the pooled connections, bundled per destination */
struct Curl_hash dest2bundle;
curl_off_t next_easy_id;
struct curltime last_cleanup;
struct Curl_easy *idata; /* internal handle for maintenance */
- struct Curl_share *share; /* != NULL iff pool belongs to share */
- Curl_cpool_disconnect_cb *disconnect_cb;
+ struct Curl_share *share; /* != NULL if pool belongs to share */
BIT(locked);
BIT(initialised);
};
* returns 1 on error, 0 is fine.
*/
int Curl_cpool_init(struct cpool *cpool,
- Curl_cpool_disconnect_cb *disconnect_cb,
struct Curl_easy *idata,
struct Curl_share *share,
size_t size);
if(Curl_cshutdn_init(&multi->cshutdn, multi))
goto error;
- if(Curl_cpool_init(&multi->cpool, Curl_on_disconnect,
- multi->admin, NULL, chashsize))
+ if(Curl_cpool_init(&multi->cpool, multi->admin, NULL, chashsize))
goto error;
if(Curl_ssl_scache_create(sesssize, 2, &multi->ssl_scache))
case CURL_LOCK_DATA_CONNECT:
/* It is safe to set this option several times on a share. */
if(!share->cpool.initialised) {
- if(Curl_cpool_init(&share->cpool, Curl_on_disconnect,
- share->admin, share, 103))
+ if(Curl_cpool_init(&share->cpool, share->admin, share, 103))
res = CURLSHE_NOMEM;
}
break;
free(conn); /* free all the connection oriented data */
}
-/*
- * Disconnects the given connection. Note the connection may not be the
- * primary connection, like when freeing room in the connection pool or
- * killing of a dead old connection.
- *
- * A connection needs an easy handle when closing down. We support this passed
- * in separately since the connection to get closed here is often already
- * disassociated from an easy handle.
- *
- * This function MUST NOT reset state in the Curl_easy struct if that
- * is not strictly bound to the life-time of *this* particular connection.
- */
-bool Curl_on_disconnect(struct Curl_easy *data,
- struct connectdata *conn, bool aborted)
-{
- /* there must be a connection to close */
- DEBUGASSERT(conn);
-
- /* it must be removed from the connection pool */
- DEBUGASSERT(!conn->bits.in_cpool);
-
- /* there must be an associated transfer */
- DEBUGASSERT(data);
-
- /* the transfer must be detached from the connection */
- DEBUGASSERT(!data->conn);
-
- DEBUGF(infof(data, "Curl_disconnect(conn #%" FMT_OFF_T ", aborted=%d)",
- conn->connection_id, aborted));
-
- if(conn->dns_entry)
- Curl_resolv_unlink(data, &conn->dns_entry);
-
- /* Cleanup NTLM connection-related data */
- Curl_http_auth_cleanup_ntlm(conn);
-
- /* Cleanup NEGOTIATE connection-related data */
- Curl_http_auth_cleanup_negotiate(conn);
-
- if(conn->connect_only)
- /* treat the connection as aborted in CONNECT_ONLY situations */
- aborted = TRUE;
-
- return aborted;
-}
-
/*
* xfer_may_multiplex()
*
CURLcode Curl_uc_to_curlcode(CURLUcode uc);
CURLcode Curl_close(struct Curl_easy **datap); /* opposite of curl_open() */
CURLcode Curl_connect(struct Curl_easy *, bool *async, bool *protocol_connect);
-bool Curl_on_disconnect(struct Curl_easy *data,
- struct connectdata *, bool aborted);
CURLcode Curl_setup_conn(struct Curl_easy *data,
bool *protocol_done);
void Curl_conn_free(struct Curl_easy *data, struct connectdata *conn);
docname = 'data-10k'
port = env.port_for(proto)
url = f'https://{env.domain1}:{port}/{docname}'
- client = LocalClient(name='hx-download', env=env)
+ run_env = os.environ.copy()
+ run_env['CURL_DEBUG'] = 'multi'
+ client = LocalClient(name='hx-download', env=env, run_env=run_env)
if not client.exists():
pytest.skip(f'example client not built: {client.name}')
r = client.run(args=[
docname = 'data-10k'
port = env.port_for(proto)
url = f'https://{env.domain1}:{port}/{docname}'
- client = LocalClient(name='hx-download', env=env)
+ run_env = os.environ.copy()
+ run_env['CURL_DEBUG'] = 'multi'
+ client = LocalClient(name='hx-download', env=env, run_env=run_env)
if not client.exists():
pytest.skip(f'example client not built: {client.name}')
r = client.run(args=[