Beispiel #1
0
static void rtsp_client_free(RTSP_Client *client)
{
    GString *outbuf = NULL;
    close(client->sd);
    g_free(client->local_host);
    g_free(client->remote_host);

    rtsp_session_free(client->session);

    if ( client->channels )
        g_hash_table_destroy(client->channels);

    /* Remove the output queue */
    if ( client->out_queue ) {
        while( (outbuf = g_queue_pop_tail(client->out_queue)) )
            g_string_free(outbuf, TRUE);

        g_queue_free(client->out_queue);
    }

    if ( client->input ) /* not present on SCTP or HTTP transports */
        g_byte_array_free(client->input, true);

    g_slice_free(RFC822_Request, client->pending_request);

    g_slice_free1(client->sa_len, client->peer_sa);
    g_slice_free1(client->sa_len, client->local_sa);

    g_slice_free(RTSP_Client, client);

    fnc_log(FNC_LOG_INFO, "[client] Client removed");
}
Beispiel #2
0
/**
 * RTSP TEARDOWN method handler
 * @param rtsp the buffer for which to handle the method
 * @param req The client request for the method
 * @todo trigger the release of rtp resources here
 */
void RTSP_teardown(RTSP_Client *rtsp, RFC822_Request *req)
{
    if ( !rfc822_request_check_url(rtsp, req) )
        return;
    rtsp_session_free(rtsp->session);
    rtsp->session = NULL;

    rtsp_quick_response(rtsp, req, RTSP_Ok);
}
Beispiel #3
0
/**
 * @brief Handle client disconnection and free resources
 *
 * @param loop The event loop where the event was issued
 * @param w The async event object
 * @param revents Unused
 *
 * This event is triggered when a client disconnects or is forcefully
 * disconnected. It stops the other events from running, and frees all
 * the remaining resources for the client itself.
 */
static void client_ev_disconnect_handler(struct ev_loop *loop,
                                         ev_async *w,
                                         int revents)
{
    RTSP_Client *rtsp = (RTSP_Client*)w->data;
    GString *outbuf = NULL;
    feng *srv = rtsp->srv;

    ev_io_stop(srv->loop, &rtsp->ev_io_read);
    ev_io_stop(srv->loop, &rtsp->ev_io_write);
    ev_async_stop(srv->loop, &rtsp->ev_sig_disconnect);
    ev_timer_stop(srv->loop, &rtsp->ev_timeout);

    Sock_close(rtsp->sock);
    srv->connection_count--;

    rtsp_session_free(rtsp->session);
    
    r_close(rtsp->cached_resource);

    interleaved_free_list(rtsp);

    /* Remove the output queue */
    while( (outbuf = g_queue_pop_tail(rtsp->out_queue)) )
        g_string_free(outbuf, TRUE);

    g_queue_free(rtsp->out_queue);

    g_byte_array_free(rtsp->input, true);

    g_slice_free(RTSP_Client, rtsp);

    fnc_log(FNC_LOG_INFO, "[client] Client removed");

    demuxer_stsw_global_uninit();
    
	sleep(1);
	exit(0);

}