예제 #1
0
void slave_initialize(void)
{
    if (slave_running)
        return;

    thread_rwlock_create (&slaves_lock);
    slave_running = 1;
    streamlister = 0;
    streamlist_check = 0;
    update_settings = 0;
    update_all_sources = 0;
    restart_connection_thread = 0;
    redirectors = NULL;
    workers = NULL;
    worker_count = 0;
    relays_connecting = 0;
    thread_spin_create (&relay_start_lock);
    thread_rwlock_create (&workers_lock);
    inactivity_timeout = 0;
    inactivity_timer = 0;
#ifndef HAVE_CURL
    ERROR0 ("streamlist request disabled, rebuild with libcurl if required");
#endif
    _slave_thread ();
    yp_stop ();
    workers_adjust(0);
}
예제 #2
0
파일: yp.c 프로젝트: cmelendez/icecast-kh
void yp_initialize (ice_config_t *config)
{
    thread_rwlock_create (&yp_lock);
    thread_mutex_create (&yp_pending_lock);
    yp_recheck_config (config);
    yp_initialised = 1;
}
예제 #3
0
static auth_t *auth_get_htpasswd_auth(config_options_t *options)
{
    auth_t *authenticator = calloc(1, sizeof(auth_t));
    htpasswd_auth_state *state;

    authenticator->authenticate = htpasswd_auth;
    authenticator->free = htpasswd_clear;

    state = calloc(1, sizeof(htpasswd_auth_state));

    state->allow_duplicate_users = 1;
    while(options) {
        if(!strcmp(options->name, "filename"))
            state->filename = strdup(options->value);
        if(!strcmp(options->name, "allow_duplicate_users"))
            state->allow_duplicate_users = atoi(options->value);
        options = options->next;
    }

    if(!state->filename) {
        free(state);
        free(authenticator);
        ERROR0("No filename given in options for authenticator.");
        return NULL;
    }

    authenticator->state = state;
    DEBUG1("Configured htpasswd authentication using password file %s", 
            state->filename);

    thread_rwlock_create(&state->file_rwlock);

    return authenticator;
}
예제 #4
0
int  auth_get_htpasswd_auth (auth_t *authenticator, config_options_t *options)
{
    htpasswd_auth_state *state;

    authenticator->authenticate = htpasswd_auth;
    authenticator->free = htpasswd_clear;
    authenticator->adduser = htpasswd_adduser;
    authenticator->deleteuser = htpasswd_deleteuser;
    authenticator->listuser = htpasswd_userlist;

    state = calloc(1, sizeof(htpasswd_auth_state));

    while(options) {
        if(!strcmp(options->name, "filename"))
            state->filename = strdup(options->value);
        options = options->next;
    }

    if(!state->filename) {
        free(state);
        ERROR0("No filename given in options for authenticator.");
        return -1;
    }

    authenticator->state = state;
    DEBUG1("Configured htpasswd authentication using password file %s", 
            state->filename);

    thread_rwlock_create(&state->file_rwlock);
    htpasswd_recheckfile (state);

    return 0;
}
예제 #5
0
파일: connection.c 프로젝트: xaiki/IceCast
void connection_initialize(void)
{
    if (_initialized) return;

    thread_spin_create (&_connection_lock);
    thread_mutex_create(&move_clients_mutex);
    thread_rwlock_create(&_source_shutdown_rwlock);
    thread_cond_init(&global.shutdown_cond);
    _con_queue = NULL;
    _con_queue_tail = &_con_queue;

    banned_ip.contents = NULL;
    banned_ip.file_mtime = 0;

    allowed_ip.contents = NULL;
    allowed_ip.file_mtime = 0;

    _connection_running = 1;
    /* (XXX)xaiki: need a way to make it go away on shutdown, ok for now */
    _connection_thread_id = thread_create ("Connection Thread", _connection_thread,
					   NULL, THREAD_DETACHED);
    _connection_cond = thread_cond_create ();

    _initialized = 1;
}
예제 #6
0
void yp_initialize()
{
    ice_config_t *config = config_get_config();
    thread_rwlock_create (&yp_lock);
    thread_mutex_create (&yp_pending_lock);
    yp_recheck_config (config);
    config_release_config ();
    yp_thread = thread_create("YP Touch Thread", yp_update_thread,
                              (void *)NULL, THREAD_ATTACHED);
}
예제 #7
0
int main(void)
{
	int rv;
	thread_rwlock_t *thread_rwlock = NULL;
	rv = thread_rwlock_create(&thread_rwlock);
	rv = thread_rwlock_wrlock(thread_rwlock);
	rv = thread_rwlock_unlock(thread_rwlock);
	thread_rwlock_destroy(thread_rwlock);
	return 0;
}
예제 #8
0
void global_initialize(void)
{
    memset (&global, 0, sizeof (global));
    global.source_tree = avl_tree_new(source_compare_sources, NULL);
#ifdef MY_ALLOC
    global.alloc_tree = avl_tree_new(compare_allocs, NULL);
#endif
    thread_mutex_create(&_global_mutex);
    thread_rwlock_create(&global.workers_rw);
    global.out_bitrate = rate_setup (20000, 1000);
}
예제 #9
0
파일: xslt.c 프로젝트: balbinus/icecast-kh
void xslt_initialize(void)
{
    memset (&cache[0], 0, sizeof cache);
    thread_rwlock_create (&xslt_lock);
    thread_spin_create (&update_lock);
    xsl_updating = 0;
    xmlInitParser();
    LIBXML_TEST_VERSION
    xmlSubstituteEntitiesDefault(1);
    xmlLoadExtDtdDefaultValue = 1;
}
예제 #10
0
파일: xslt.c 프로젝트: cmelendez/icecast-kh
void xslt_initialize(void)
{
    memset(cache, 0, sizeof(stylesheet_cache_t)*CACHESIZE);
    thread_mutex_create(&xsltlock);
    thread_rwlock_create (&xslt_lock);
    thread_spin_create (&update_lock);
    xsl_updating = 0;
    xmlInitParser();
    LIBXML_TEST_VERSION
    xmlSubstituteEntitiesDefault(1);
    xmlLoadExtDtdDefaultValue = 1;
}
예제 #11
0
void connection_initialize(void)
{
    if (_initialized) return;
    
    thread_mutex_create(&_connection_mutex);
    thread_mutex_create(&_queue_mutex);
    thread_mutex_create(&move_clients_mutex);
    thread_rwlock_create(&_source_shutdown_rwlock);
    thread_cond_create(&global.shutdown_cond);

    _initialized = 1;
}
예제 #12
0
파일: avl.c 프로젝트: xaiki/IceCast
avl_tree *
avl_tree_new (avl_key_compare_fun_type compare_fun,
          void * compare_arg)
{
  avl_tree * t = (avl_tree *) malloc (sizeof (avl_tree));
  avl_node * root = avl_node_new((void *)NULL, (avl_node *) NULL);
  if (!t)
    abort();
  t->root = root;
  t->height = 0;
  t->length = 0;
  t->compare_fun = compare_fun;
  t->compare_arg = compare_arg;
  thread_rwlock_create(&t->rwlock);
  return t;
}
예제 #13
0
파일: avl.c 프로젝트: xaiki/IceCast
avl_node *
avl_node_new (void *        key,
          avl_node *    parent)
{
  avl_node * node = (avl_node *) malloc (sizeof (avl_node));
  if (!node)
    abort();

  node->parent = parent;
  node->key = key;
  node->left = NULL;
  node->right = NULL;
  node->rank_and_balance = 0;
  AVL_SET_BALANCE (node, 0);
  AVL_SET_RANK (node, 1);
#ifdef HAVE_AVL_NODE_LOCK
  thread_rwlock_create(&node->rwlock);
#endif
  return node;
}
예제 #14
0
void connection_initialize(void)
{
    if (_initialized) return;
    
    thread_spin_create (&_connection_lock);
    thread_mutex_create(&move_clients_mutex);
    thread_rwlock_create(&_source_shutdown_rwlock);
    thread_cond_create(&global.shutdown_cond);
    _req_queue = NULL;
    _req_queue_tail = &_req_queue;
    _con_queue = NULL;
    _con_queue_tail = &_con_queue;

    banned_ip.contents = NULL;
    banned_ip.file_mtime = 0;

    allowed_ip.contents = NULL;
    allowed_ip.file_mtime = 0;

    _initialized = 1;
}
예제 #15
0
파일: auth.c 프로젝트: balbinus/icecast-kh
void auth_initialise (void)
{
    thread_rwlock_create (&auth_lock);
    thread_id = 0;
    allow_auth = 1;
}
예제 #16
0
파일: cfgfile.c 프로젝트: miksago/icecast
static void create_locks(void) {
    thread_mutex_create(&_locks.relay_lock);
    thread_rwlock_create(&_locks.config_lock);
}
예제 #17
0
static void create_locks(void) {
    thread_rwlock_create(&_locks.config_lock);
}