Commit 93194594 authored by Philipp Schafft's avatar Philipp Schafft 🦁

better coding style, patch by ePirat. refs #2059

svn path=/icecast/trunk/icecast/; revision=19376
parent ea71438a
......@@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
......@@ -246,10 +246,10 @@ xmlDocPtr admin_build_sourcelist (const char *mount)
srcnode = xmlNewChild(xmlnode, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
xmlNewChild(srcnode, NULL, XMLSTR("fallback"),
xmlNewChild(srcnode, NULL, XMLSTR("fallback"),
(source->fallback_mount != NULL)?
XMLSTR(source->fallback_mount):XMLSTR(""));
snprintf (buf, sizeof(buf), "%lu", source->listeners);
snprintf(buf, sizeof(buf), "%lu", source->listeners);
xmlNewChild(srcnode, NULL, XMLSTR("listeners"), XMLSTR(buf));
config = config_get_config();
......@@ -297,8 +297,8 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
if (buf_len < 4096)
buf_len = 4096;
client_set_queue (client, NULL);
client->refbuf = refbuf_new (buf_len);
client_set_queue(client, NULL);
client->refbuf = refbuf_new(buf_len);
ret = util_http_build_header(client->refbuf->data, buf_len, 0,
0, 200, NULL,
......@@ -587,8 +587,8 @@ static void html_success(client_t *client, char *message)
}
snprintf(client->refbuf->data + ret, PER_CLIENT_REFBUF_SIZE - ret,
"<html><head><title>Admin request successful</title></head>"
"<body><p>%s</p></body></html>", message);
"<html><head><title>Admin request successful</title></head>"
"<body><p>%s</p></body></html>", message);
client->respcode = 200;
client->refbuf->len = strlen (client->refbuf->data);
......@@ -649,7 +649,7 @@ static void command_move_clients(client_t *client, source_t *source,
memset(buf, '\000', sizeof(buf));
snprintf (buf, sizeof(buf), "Clients moved from %s to %s",
source->mount, dest_source);
source->mount, dest_source);
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
......@@ -721,7 +721,7 @@ static void command_show_listeners(client_t *client, source_t *source,
xmlNodePtr node, srcnode;
char buf[22];
doc = xmlNewDoc (XMLSTR("1.0"));
doc = xmlNewDoc(XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
......@@ -761,8 +761,8 @@ static void command_buildm3u(client_t *client, const char *mount)
config = config_get_config();
snprintf (client->refbuf->data + ret, PER_CLIENT_REFBUF_SIZE - ret,
"Content-Disposition = attachment; filename=listen.m3u\r\n\r\n"
snprintf(client->refbuf->data + ret, PER_CLIENT_REFBUF_SIZE - ret,
"Content-Disposition = attachment; filename=listen.m3u\r\n\r\n"
"http://%s:%s@%s:%d%s\r\n",
username,
password,
......@@ -814,7 +814,7 @@ static void command_manageauth(client_t *client, source_t *source,
if (!strcmp(action, "add"))
{
const char *password = NULL;
COMMAND_OPTIONAL (client, "password", password);
COMMAND_OPTIONAL(client, "password", password);
if (username == NULL || password == NULL)
{
......@@ -848,7 +848,7 @@ static void command_manageauth(client_t *client, source_t *source,
}
}
doc = xmlNewDoc (XMLSTR("1.0"));
doc = xmlNewDoc(XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
......@@ -890,7 +890,7 @@ static void command_kill_source(client_t *client, source_t *source,
source->running = 0;
admin_send_response(doc, client, response,
admin_send_response(doc, client, response,
ADMIN_XSL_RESPONSE);
xmlFreeDoc(doc);
}
......@@ -966,7 +966,7 @@ static void command_metadata(client_t *client, source_t *source,
xmlNodePtr node;
int same_ip = 1;
doc = xmlNewDoc (XMLSTR("1.0"));
doc = xmlNewDoc(XMLSTR("1.0"));
node = xmlNewDocNode (doc, NULL, XMLSTR("iceresponse"), NULL);
xmlDocSetRootElement(doc, node);
......
......@@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
......
......@@ -268,7 +268,7 @@ static void *auth_run_thread (void *arg)
if (auth->head == NULL)
auth->tailp = &auth->head;
auth->pending_count--;
thread_mutex_unlock (&auth->lock);
thread_mutex_unlock(&auth->lock);
auth_user->next = NULL;
if (auth_user->process) {
......@@ -409,9 +409,9 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
}
auth_t *auth_get_authenticator (xmlNodePtr node)
auth_t *auth_get_authenticator(xmlNodePtr node)
{
auth_t *auth = calloc (1, sizeof (auth_t));
auth_t *auth = calloc(1, sizeof(auth_t));
config_options_t *options = NULL, **next_option = &options;
xmlNodePtr option;
char *method;
......
......@@ -150,7 +150,7 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
htpasswd_user *entry;
num++;
if(!line[0] || line[0] == '#')
if (!line[0] || line[0] == '#')
continue;
sep = strrchr (line, ':');
......@@ -247,7 +247,7 @@ int auth_get_htpasswd_auth (auth_t *authenticator, config_options_t *options)
authenticator->state = state;
thread_rwlock_create(&state->file_rwlock);
htpasswd_recheckfile (state);
htpasswd_recheckfile(state);
return 0;
}
......@@ -376,8 +376,8 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
}
}
free(tmpfile);
thread_rwlock_unlock (&state->file_rwlock);
htpasswd_recheckfile (state);
thread_rwlock_unlock(&state->file_rwlock);
htpasswd_recheckfile(state);
return AUTH_USERDELETED;
}
......
......@@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
......@@ -17,7 +17,7 @@
#include <config.h>
#endif
int auth_get_htpasswd_auth (auth_t *auth, config_options_t *options);
int auth_get_htpasswd_auth(auth_t *auth, config_options_t *options);
#endif
......
......@@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org>,
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org>,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
......@@ -11,7 +11,7 @@
* Copyright 2011-2014, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
/*
/*
* Client authentication via URL functions
*
* authenticate user via a URL, this is done via libcurl so https can also
......@@ -60,11 +60,11 @@
#include <errno.h>
#include <stdio.h>
#ifndef _WIN32
#include <sys/wait.h>
#include <strings.h>
# include <sys/wait.h>
# include <strings.h>
#else
#define snprintf _snprintf
#define strncasecmp strnicmp
# define snprintf _snprintf
# define strncasecmp strnicmp
#endif
#include <curl/curl.h>
......@@ -415,7 +415,7 @@ static auth_result auth_url_listuser (auth_t *auth, xmlNodePtr srcnode)
return AUTH_FAILED;
}
int auth_get_url_auth (auth_t *authenticator, config_options_t *options)
int auth_get_url_auth(auth_t *authenticator, config_options_t *options)
{
auth_url *url_info;
const char * addaction = "listener_add";
......@@ -430,8 +430,8 @@ int auth_get_url_auth (auth_t *authenticator, config_options_t *options)
authenticator->state = url_info;
/* default headers */
url_info->auth_header = strdup ("icecast-auth-user: 1\r\n");
url_info->timelimit_header = strdup ("icecast-auth-timelimit:");
url_info->auth_header = strdup("icecast-auth-user: 1\r\n");
url_info->timelimit_header = strdup("icecast-auth-timelimit:");
/* force auth thread to call function. this makes sure the auth_t is attached to client */
authenticator->authenticate_client = url_add_client;
......
......@@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
......@@ -313,7 +313,7 @@ static inline ice_config_http_header_t * config_copy_http_header(ice_config_http
return ret;
}
static void config_clear_mount (mount_proxy *mount)
static void config_clear_mount(mount_proxy *mount)
{
if (mount->mountname) xmlFree (mount->mountname);
if (mount->dumpfile) xmlFree (mount->dumpfile);
......@@ -391,7 +391,7 @@ void config_clear(ice_config_t *c)
thread_mutex_lock(&(_locks.relay_lock));
relay = c->relay;
while(relay) {
while (relay) {
nextrelay = relay->next;
xmlFree(relay->server);
xmlFree(relay->mount);
......@@ -402,14 +402,14 @@ void config_clear(ice_config_t *c)
thread_mutex_unlock(&(_locks.relay_lock));
mount = c->mounts;
while(mount) {
while (mount) {
nextmount = mount->next;
config_clear_mount (mount);
config_clear_mount(mount);
mount = nextmount;
}
alias = c->aliases;
while(alias) {
while (alias) {
nextalias = alias->next;
xmlFree(alias->source);
xmlFree(alias->destination);
......@@ -420,7 +420,7 @@ void config_clear(ice_config_t *c)
}
dirnode = c->dir_list;
while(dirnode) {
while (dirnode) {
nextdirnode = dirnode->next;
xmlFree(dirnode->host);
free(dirnode);
......@@ -521,9 +521,9 @@ ice_config_t *config_get_config_unlocked(void)
static void _set_defaults(ice_config_t *configuration)
{
configuration->location = (char *)xmlCharStrdup (CONFIG_DEFAULT_LOCATION);
configuration->server_id = (char *)xmlCharStrdup (ICECAST_VERSION_STRING);
configuration->admin = (char *)xmlCharStrdup (CONFIG_DEFAULT_ADMIN);
configuration->location = (char *) xmlCharStrdup(CONFIG_DEFAULT_LOCATION);
configuration->server_id = (char *) xmlCharStrdup(ICECAST_VERSION_STRING);
configuration->admin = (char *) xmlCharStrdup(CONFIG_DEFAULT_ADMIN);
configuration->client_limit = CONFIG_DEFAULT_CLIENT_LIMIT;
configuration->source_limit = CONFIG_DEFAULT_SOURCE_LIMIT;
configuration->queue_size_limit = CONFIG_DEFAULT_QUEUE_SIZE_LIMIT;
......@@ -1274,8 +1274,8 @@ static void _parse_relay(xmlDocPtr doc, xmlNodePtr node,
relay->next = NULL;
relay->mp3metadata = 1;
relay->on_demand = configuration->on_demand;
relay->server = (char *)xmlCharStrdup ("127.0.0.1");
relay->mount = (char *)xmlCharStrdup ("/");
relay->server = (char *) xmlCharStrdup("127.0.0.1");
relay->mount = (char *) xmlCharStrdup("/");
do {
if (node == NULL) break;
......@@ -1418,7 +1418,7 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
if (xmlStrcmp(node->name, XMLSTR("source-password")) == 0) {
if (xmlGetProp(node, XMLSTR("mount"))) {
ICECAST_LOG_ERROR("Mount level source password defined within global <authentication> section.");
}
......@@ -1600,7 +1600,7 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
alias->vhost = (char *)xmlGetProp(node, XMLSTR("vhost"));
current = configuration->aliases;
last = NULL;
while(current) {
while (current) {
last = current;
current = current->next;
}
......@@ -1703,12 +1703,12 @@ static void _add_server(xmlDocPtr doc, xmlNodePtr node,
if (node == NULL) break;
if (xmlIsBlankNode(node)) continue;
if (xmlStrcmp (node->name, XMLSTR("host")) == 0) {
server->host = (char *)xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
if (xmlStrcmp(node->name, XMLSTR("host")) == 0) {
server->host = (char *) xmlNodeListGetString(doc,
node->xmlChildrenNode, 1);
addnode = 1;
} else if (xmlStrcmp (node->name, XMLSTR("touch-interval")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (xmlStrcmp(node->name, XMLSTR("touch-interval")) == 0) {
tmp = (char *) xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
server->touch_interval = atoi(tmp);
if (tmp) xmlFree(tmp);
}
......@@ -1850,7 +1850,7 @@ mount_proxy *config_find_mount (ice_config_t *config, const char *mount, mount_t
/* retry with default mount */
if (!mountinfo && type == MOUNT_TYPE_NORMAL)
mountinfo = config_find_mount(config, mount, MOUNT_TYPE_DEFAULT);
mountinfo = config_find_mount(config, mount, MOUNT_TYPE_DEFAULT);
return mountinfo;
}
......@@ -1858,7 +1858,7 @@ mount_proxy *config_find_mount (ice_config_t *config, const char *mount, mount_t
/* Helper function to locate the configuration details of the listening
* socket
*/
listener_t *config_get_listen_sock (ice_config_t *config, connection_t *con)
listener_t *config_get_listen_sock(ice_config_t *config, connection_t *con)
{
listener_t *listener;
int i = 0;
......
......@@ -15,10 +15,10 @@
#ifndef __CFGFILE_H__
#define __CFGFILE_H__
#define CONFIG_EINSANE -1
#define CONFIG_ENOROOT -2
#define CONFIG_EINSANE -1
#define CONFIG_ENOROOT -2
#define CONFIG_EBADROOT -3
#define CONFIG_EPARSE -4
#define CONFIG_EPARSE -4
#define MAX_YP_DIRECTORIES 25
......@@ -78,7 +78,7 @@ typedef struct _mount_proxy {
char *dumpfile; /* Filename to dump this stream to (will be appended). NULL
to not dump. */
char *intro_filename; /* Send contents of file to client before the stream */
char *intro_filename; /* Send contents of file to client before the stream */
int fallback_when_full; /* switch new listener to fallback source
when max listeners reached */
int max_listeners; /* Max listeners for this mountpoint only. -1 to not
......@@ -93,8 +93,8 @@ typedef struct _mount_proxy {
* from global setting */
unsigned int queue_size_limit;
int hidden; /* Do we list this on the xsl pages */
unsigned int source_timeout; /* source timeout in seconds */
char *charset; /* character set if not utf8 */
unsigned int source_timeout; /* source timeout in seconds */
char *charset; /* character set if not utf8 */
int mp3_meta_interval; /* outgoing per-stream metadata interval */
ice_config_http_header_t *http_headers; /* additional HTTP headers */
......@@ -203,8 +203,8 @@ typedef struct ice_config_tag {
char *user;
char *group;
char *yp_url[MAX_YP_DIRECTORIES];
int yp_url_timeout[MAX_YP_DIRECTORIES];
int yp_touch_interval[MAX_YP_DIRECTORIES];
int yp_url_timeout[MAX_YP_DIRECTORIES];
int yp_touch_interval[MAX_YP_DIRECTORIES];
int num_yp_directories;
} ice_config_t;
......
......@@ -12,10 +12,10 @@
*/
/* client.c
**
** client interface implementation
**
*/
**
** client interface implementation
**
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
......@@ -58,16 +58,16 @@ static inline void client_send_500(client_t *client, const char *message);
* client_t is returned just in case a message needs to be returned. Should
* be called with global lock held.
*/
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser)
int client_create(client_t **c_ptr, connection_t *con, http_parser_t *parser)
{
ice_config_t *config;
client_t *client = (client_t *)calloc(1, sizeof(client_t));
client_t *client = (client_t *) calloc(1, sizeof(client_t));
int ret = -1;
if (client == NULL)
abort();
config = config_get_config ();
config = config_get_config();
global.clients++;
if (config->client_limit < global.clients)
......@@ -119,14 +119,14 @@ void client_destroy(client_t *client)
if (client->parser)
httpp_destroy(client->parser);
global_lock ();
global_lock();
global.clients--;
stats_event_args (NULL, "clients", "%d", global.clients);
global_unlock ();
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);
client->free_client_data(client);
free(client->username);
free(client->password);
......@@ -137,7 +137,7 @@ void client_destroy(client_t *client)
}
/* helper function for reading data from a client */
int client_read_bytes (client_t *client, void *buf, unsigned len)
int client_read_bytes(client_t *client, void *buf, unsigned len)
{
int bytes;
......@@ -216,9 +216,9 @@ static inline void client_send_500(client_t *client, const char *message) {
}
/* helper function for sending the data to a client */
int client_send_bytes (client_t *client, const void *buf, unsigned len)
int client_send_bytes(client_t *client, const void *buf, unsigned len)
{
int ret = client->con->send (client->con, buf, len);
int ret = client->con->send(client->con, buf, len);
if (client->con->error)
ICECAST_LOG_DEBUG("Client connection died");
......@@ -226,14 +226,14 @@ int client_send_bytes (client_t *client, const void *buf, unsigned len)
return ret;
}
void client_set_queue (client_t *client, refbuf_t *refbuf)
void client_set_queue(client_t *client, refbuf_t *refbuf)
{
refbuf_t *to_release = client->refbuf;
client->refbuf = refbuf;
if (refbuf)
refbuf_addref (client->refbuf);
refbuf_addref(client->refbuf);
client->pos = 0;
if (to_release)
refbuf_release (to_release);
refbuf_release(to_release);
}
......@@ -12,10 +12,10 @@
*/
/* client.h
**
** client data structions and function definitions
**
*/
**
** client data structions and function definitions
**
*/
#ifndef __CLIENT_H__
#define __CLIENT_H__
......
......@@ -181,9 +181,9 @@ static unsigned long _next_connection_id(void)
{
unsigned long id;
thread_spin_lock (&_connection_lock);
thread_spin_lock(&_connection_lock);
id = _current_id++;
thread_spin_unlock (&_connection_lock);
thread_spin_unlock(&_connection_lock);
return id;
}
......@@ -196,8 +196,8 @@ static void get_ssl_certificate (ice_config_t *config)
long ssl_opts;
ssl_ok = 0;
SSL_load_error_strings(); /* readable error messages */
SSL_library_init(); /* initialize library */
SSL_load_error_strings(); /* readable error messages */
SSL_library_init(); /* initialize library */
method = SSLv23_server_method();
ssl_ctx = SSL_CTX_new (method);
......@@ -253,7 +253,7 @@ static int connection_read_ssl (connection_t *con, void *buf, size_t len)
{
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
return -1;
return -1;
}
con->error = 1;
}
......@@ -281,7 +281,7 @@ static int connection_send_ssl (connection_t *con, const void *buf, size_t len)
#else
/* SSL not compiled in, so at least log it */
static void get_ssl_certificate (ice_config_t *config)
static void get_ssl_certificate(ice_config_t *config)
{
ssl_ok = 0;
ICECAST_LOG_INFO("No SSL capability");
......@@ -319,7 +319,7 @@ static int connection_send (connection_t *con, const void *buf, size_t len)
/* function to handle the re-populating of the avl tree containing IP addresses
* for deciding whether a connection of an incoming request is to be dropped.
*/
static void recheck_ip_file (cache_file_contents *cache)
static void recheck_ip_file(cache_file_contents *cache)
{
time_t now = time(NULL);
if (now >= cache->file_recheck)
......@@ -379,12 +379,12 @@ static void recheck_ip_file (cache_file_contents *cache)
/* return 0 if the passed ip address is not to be handled by icecast, non-zero otherwise */
static int accept_ip_address (char *ip)
static int accept_ip_address(char *ip)
{
void *result;
recheck_ip_file (&banned_ip);
recheck_ip_file (&allowed_ip);
recheck_ip_file(&banned_ip);
recheck_ip_file(&allowed_ip);
if (banned_ip.contents)
{
......@@ -431,7 +431,7 @@ connection_t *connection_create (sock_t sock, sock_t serversock, char *ip)
/* prepare connection for interacting over a SSL connection
*/
void connection_uses_ssl (connection_t *con)
void connection_uses_ssl(connection_t *con)
{
#ifdef HAVE_OPENSSL
con->read = connection_read_ssl;
......@@ -480,9 +480,9 @@ static sock_t wait_for_serversock(int timeout)
for(i=0, dst=0; i < global.server_sockets; i++)
{
if (global.serversock[i] == SOCK_ERROR)
continue;
continue;
if (i!=dst)
global.serversock[dst] = global.serversock[i];
global.serversock[dst] = global.serversock[i];
dst++;
}
global.server_sockets = dst;
......@@ -568,12 +568,12 @@ static connection_t *_accept_connection(int duration)
* has been collected, so we now pass it onto the connection thread for
* further processing
*/
static void _add_connection (client_queue_t *node)
static void _add_connection(client_queue_t *node)
{
thread_spin_lock (&_connection_lock);
thread_spin_lock(&_connection_lock);
*_con_queue_tail = node;
_con_queue_tail = (volatile client_queue_t **)&node->next;
thread_spin_unlock (&_connection_lock);
_con_queue_tail = (volatile client_queue_t **) &node->next;
thread_spin_unlock(&_connection_lock);
}
......@@ -1564,15 +1564,15 @@ int connection_setup_sockets (ice_config_t *config)
/* setup the banned/allowed IP filenames from the xml */
if (config->banfile)
banned_ip.filename = strdup (config->banfile);
banned_ip.filename = strdup(config->banfile);
if (config->allowfile)
allowed_ip.filename = strdup (config->allowfile);
allowed_ip.filename = strdup(config->allowfile);
count = 0;
global.serversock = calloc (config->listen_sock_count, sizeof (sock_t));
global.serversock = calloc(config->listen_sock_count, sizeof(sock_t));
listener = config->listen_sock;
listener = config->listen_sock;
prev = &config->listen_sock;
while (listener)
{
......
......@@ -43,7 +43,7 @@ typedef struct connection_tag
int error;
#ifdef HAVE_OPENSSL
SSL *ssl; /* SSL handler */
SSL *ssl; /* SSL handler */
#endif
int (*send)(struct connection_tag *handle, const void *buf, size_t len);
int (*read)(struct connection_tag *handle, void *buf, size_t len);
......@@ -56,10 +56,10 @@ typedef struct connection_tag
void connection_initialize(void);
void connection_shutdown(void);
void connection_accept_loop(void);
int connection_setup_sockets (struct ice_config_tag *config);
int connection_setup_sockets(struct ice_config_tag *config);
void connection_close(connection_t *con);
connection_t *connection_create (sock_t sock, sock_t serversock, char *ip);
int connection_complete_source (struct source_tag *source, int response);
connection_t *connection_create(sock_t sock, sock_t serversock, char *ip);
int connection_complete_source(struct source_tag *source, int response);
extern rwlock_t _source_shutdown_rwlock;
......
......@@ -13,7 +13,7 @@
#ifndef __EVENT_H__
#define __EVENT_H__
#define EVENT_NO_EVENT 0
#define EVENT_NO_EVENT 0
#define EVENT_CONFIG_READ 1
void event_config_read(void *nothing);
......
......@@ -12,10 +12,10 @@
/* -*- c-basic-offset: 4; -*- */
/* format.c
**
** format plugin implementation
**
*/
**
** format plugin implementation
**
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
......@@ -87,16 +87,16 @@ int format_get_plugin(format_type_t type, source_t *source)
int ret = -1;
switch (type) {
case FORMAT_TYPE_OGG:
ret = format_ogg_get_plugin (source);
case FORMAT_TYPE_OGG:
ret = format_ogg_get_plugin(source);
break;
case FORMAT_TYPE_EBML:
ret = format_ebml_get_plugin (source);
case FORMAT_TYPE_EBML:
ret = format_ebml_get_plugin(source);
break;
case FORMAT_TYPE_GENERIC:
ret = format_mp3_get_plugin (source);
case FORMAT_TYPE_GENERIC:
ret = format_mp3_get_plugin(source);
break;
default:
default:
break;
}
if (ret < 0)
......@@ -110,7 +110,7 @@ int format_get_plugin(format_type_t type, source_t *source)
/* clients need to be start from somewhere in the queue so we will look for
* a refbuf which has been previously marked as a sync point.
*/
static void find_client_start (source_t *source, client_t *client)
static void find_client_start(source_t *source, client_t *client)
{
refbuf_t *refbuf = source->burst_point;
......@@ -146,7 +146,7 @@ static void find_client_start (source_t *source, client_t *client)
}
static int get_file_data (FILE *intro, client_t *client)
static int get_file_data(FILE *intro, client_t *client)
{
refbuf_t *refbuf = client->refbuf;
size_t bytes;
......@@ -211,7 +211,7 @@ int format_check_file_buffer (source_t *source, client_t *client)
/* call this to verify that the HTTP data has been sent and if so setup
* callbacks to the appropriate format functions
*/
int format_check_http_buffer (source_t *source, client_t *client)
int format_check_http_buffer(source_t *source, client_t *client)
{
refbuf_t *refbuf = client->refbuf;
......@@ -229,9 +229,9 @@ int format_check_http_buffer (source_t *source, client_t *client)
return -1;
}
client->respcode = 200;
stats_event_inc (NULL, "listeners");
stats_event_inc (NULL, "listener_connections");
stats_event_inc (source->mount, "listener_connections");
stats_event_inc(NULL, "listeners");
stats_event_inc(NULL, "listener_connections");
stats_event_inc(source->mount, "listener_connections");