Beispiel #1
0
/* process a block of data. This may be skipped, or may even kick off
 * a new connection.
 * 
 */
static void add_to_stream (struct instance *stream, input_buffer *ib)
{
    if (ib->critical)
        process_critical (stream, ib);

    /* LOG_DEBUG1 ("ops is %p", stream->ops); */
    if (stream->ops && stream->ops->process_buffer(stream, ib) < 0)
        stream_cleanup (stream);

    if (ib->type == ICES_INPUT_NONE)
        return;
    /* the normal end of stream flush */
    if (ib->eos && stream->ops)
    {
        if (stream->ops->flush_data)
        {
            LOG_DEBUG1("stream flushed due to EOS [%d]", stream->id);
            stream->ops->flush_data (stream);
        }
        /* EOS seen and handled so disable further processing until
         * another start of stream is sent.  */
        stream->ops = NULL;
    }

    return;
}
Beispiel #2
0
void *ices_runner (void *arg)
{
    struct runner *run = arg;
    struct instance *current;

#ifdef HAVE_SCHED_GET_PRIORITY_MAX
    int policy;
    struct sched_param param;

    pthread_getschedparam (pthread_self(), &policy, &param);
    param . sched_priority = sched_get_priority_min (SCHED_OTHER);

    if (pthread_setschedparam (pthread_self(), SCHED_OTHER, &param))
    {
        LOG_ERROR1 ("failed to set priority: %s", strerror (errno));
    }
    else
        LOG_INFO0 ("set priority on runner");
#endif
    LOG_INFO1 ("Runner %d ready", run->id);

    while (1)
    {
        input_buffer *buffer;
        
        buffer = runner_wait_for_data (run);

        if (buffer == NULL)
            break;

        current = run->instances;

        while (current != NULL)
        {
            add_to_stream (current, buffer);
            current = current->next;
        }

        send_to_runner (run->next, buffer);
    }

    runner_close (run->next);
    LOG_DEBUG1 ("Runner thread %d cleaning up streams", run->id);
    current = run->instances;
    while (current)
    {
        struct instance *next;
        next = current->next;
        stream_cleanup (current);
        current = next;
    }
    close (run->fd[0]);
    run->fd[0] = -1;
    run->not_running = 1;
    LOG_DEBUG1 ("Runner thread %d finshed", run->id);
    
    return NULL;
}
Beispiel #3
0
static int proto_tftp_conntrack_cleanup(void *ce_priv) {

	struct proto_tftp_conntrack_priv *priv = ce_priv;
		
	if (priv->stream)
		stream_cleanup(priv->stream);

	free(priv);

	return POM_OK;
}