/* Add client to fserve thread, client needs to have refbuf set and filled * but may provide a NULL file if no data needs to be read */ int fserve_add_client (client_t *client, FILE *file) { fserve_t *fclient = calloc (1, sizeof(fserve_t)); ICECAST_LOG_DEBUG("Adding client %p to file serving engine", client); if (fclient == NULL) { client_send_error_by_id(client, ICECAST_ERROR_GEN_MEMORY_EXHAUSTED); return -1; } fclient->file = file; fclient->client = client; fclient->ready = 0; fserve_add_pending (fclient); return 0; }
/* Add client to fserve thread, client needs to have refbuf set and filled * but may provide a NULL file if no data needs to be read */ int fserve_add_client (client_t *client, FILE *file) { fserve_t *fclient = calloc (1, sizeof(fserve_t)); DEBUG0 ("Adding client to file serving engine"); if (fclient == NULL) { client_send_404 (client, "memory exhausted"); return -1; } fclient->file = file; fclient->client = client; fclient->ready = 0; fserve_add_pending (fclient); return 0; }
/* add client to file serving engine, but just write out the buffer contents, * then pass the client to the callback with the provided arg */ void fserve_add_client_callback (client_t *client, fserve_callback_t callback, void *arg) { fserve_t *fclient = calloc (1, sizeof(fserve_t)); ICECAST_LOG_DEBUG("Adding client to file serving engine"); if (fclient == NULL) { client_send_error_by_id(client, ICECAST_ERROR_GEN_MEMORY_EXHAUSTED); return; } fclient->file = NULL; fclient->client = client; fclient->ready = 0; fclient->callback = callback; fclient->arg = arg; fserve_add_pending(fclient); }
/* add client to file serving engine, but just write out the buffer contents, * then pass the client to the callback with the provided arg */ void fserve_add_client_callback (client_t *client, fserve_callback_t callback, void *arg) { fserve_t *fclient = calloc (1, sizeof(fserve_t)); DEBUG0 ("Adding client to file serving engine"); if (fclient == NULL) { client_send_404 (client, "memory exhausted"); return; } fclient->file = NULL; fclient->client = client; fclient->ready = 0; fclient->callback = callback; fclient->arg = arg; fserve_add_pending (fclient); }