static void file_release (client_t *client) { fh_node *fh = client->shared_data; int ret = -1; if (fh->finfo.flags & FS_FALLBACK) stats_event_dec (NULL, "listeners"); remove_from_fh (fh, client); client_set_queue (client, NULL); if (client->flags & CLIENT_AUTHENTICATED && client->parser->req_type == httpp_req_get) { const char *mount = httpp_getvar (client->parser, HTTPP_VAR_URI); ice_config_t *config = config_get_config (); mount_proxy *mountinfo = config_find_mount (config, mount); if (mountinfo && mountinfo->access_log.name) logging_access_id (&mountinfo->access_log, client); ret = auth_release_listener (client, mount, mountinfo); config_release_config(); } if (ret < 0) { client->flags &= ~CLIENT_AUTHENTICATED; client_destroy (client); } global_reduce_bitrate_sampling (global.out_bitrate); }
void client_destroy(client_t *client) { if (client == NULL) return; /* release the buffer now, as the buffer could be on the source queue * and may of disappeared after auth completes */ if (client->refbuf) { refbuf_release (client->refbuf); client->refbuf = NULL; } if (auth_release_listener (client)) return; /* write log entry if ip is set (some things don't set it, like outgoing * slave requests */ if (client->respcode && client->parser) logging_access(client); if (client->con) connection_close(client->con); if (client->parser) httpp_destroy(client->parser); global_lock (); global.clients--; stats_event_args (NULL, "clients", "%d", global.clients); global_unlock (); /* we need to free client specific format data (if any) */ if (client->free_client_data) client->free_client_data (client); free(client->username); free(client->password); free(client); }