/* This function scans the connection cache for half-open/dead connections, closes and removes them. The cleanup is done at most once per second.  */
static void prune_dead_connections(struct Curl_easy *data)
/* This function scans the connection cache for half-open/dead connections, closes and removes them. The cleanup is done at most once per second.  */
static void prune_dead_connections(struct Curl_easy *data)
{
  struct curltime now = Curl_now();
  time_t elapsed = Curl_timediff(now, data->state.conn_cache->last_cleanup);
  if(elapsed >= 1000L) {
    struct prunedead prune;
    prune.data = data;
    prune.extracted = NULL;
    while(Curl_conncache_foreach(data, data->state.conn_cache, &prune,
                                 call_extract_if_dead)) {
      (void)Curl_disconnect(data, prune.extracted,TRUE);
    }
    data->state.conn_cache->last_cleanup = now;
  }
}