本文整理汇总了C++中WARN1函数的典型用法代码示例。如果您正苦于以下问题:C++ WARN1函数的具体用法?C++ WARN1怎么用?C++ WARN1使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WARN1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_relay_stream
/* wrapper for starting the provided relay stream */
static void check_relay_stream (relay_server *relay)
{
if (relay->source == NULL)
{
if (relay->localmount[0] != '/')
{
WARN1 ("relay mountpoint \"%s\" does not start with /, skipping",
relay->localmount);
return;
}
/* new relay, reserve the name */
relay->source = source_reserve (relay->localmount);
if (relay->source)
DEBUG1("Adding relay source at mountpoint \"%s\"", relay->localmount);
else
WARN1 ("new relay but source \"%s\" already exists", relay->localmount);
}
if (relay->source && !relay->running)
{
relay->thread = thread_create ("Relay Thread", start_relay_stream,
relay, THREAD_ATTACHED);
return;
}
/* the relay thread may of close down */
if (relay->cleanup && relay->thread)
{
DEBUG1 ("waiting for relay thread for \"%s\"", relay->localmount);
thread_join (relay->thread);
relay->thread = NULL;
relay->cleanup = 0;
relay->running = 0;
}
}
示例2: queue_auth_client
static void queue_auth_client (auth_client *auth_user, mount_proxy *mountinfo)
{
auth_t *auth;
if (auth_user == NULL)
return;
auth_user->next = NULL;
if (mountinfo)
{
auth = mountinfo->auth;
thread_mutex_lock (&auth->lock);
if (auth_user->client)
auth_user->client->auth = auth;
auth->refcount++;
}
else
{
if (auth_user->client == NULL || auth_user->client->auth == NULL)
{
WARN1 ("internal state is incorrect for %p", auth_user->client);
return;
}
auth = auth_user->client->auth;
thread_mutex_lock (&auth->lock);
}
DEBUG2 ("...refcount on auth_t %s is now %d", auth->mount, auth->refcount);
*auth->tailp = auth_user;
auth->tailp = &auth_user->next;
auth->pending_count++;
INFO2 ("auth on %s has %d pending", auth->mount, auth->pending_count);
thread_mutex_unlock (&auth->lock);
}
示例3: setVerboseFlags
static void
setVerboseFlags(char *str)
{
for (; *str; str++)
{
switch (*str)
{
case 'f':
verboseLevel |= WantFullNames;
break;
case 'h':
verboseLevel |= WantHiddenMaps;
break;
case 'l':
verboseLevel |= WantLongListing;
break;
case 'p':
verboseLevel |= WantPartialMaps;
break;
case 'R':
verboseLevel |= ListRecursive;
break;
default:
if (warningLevel > 4)
{
WARN1("Unknown verbose option \"%c\"\n", (unsigned int) *str);
ACTION("Ignored\n");
}
break;
}
}
return;
}
示例4: open_relay
/* This does the actual connection for a relay. A thread is
* started off if a connection can be acquired
*/
int open_relay (relay_server *relay)
{
source_t *src = relay->source;
relay_server_master *master = relay->masters;
client_t *client = src->client;
do
{
int ret;
if (master->skip)
{
INFO3 ("skipping %s:%d for %s", master->ip, master->port, relay->localmount);
continue;
}
thread_mutex_unlock (&src->lock);
ret = open_relay_connection (client, relay, master);
thread_mutex_lock (&src->lock);
if (ret < 0)
continue;
if (connection_complete_source (src) < 0)
{
WARN1 ("Failed to complete initialisation on %s", relay->localmount);
continue;
}
return 1;
} while ((master = master->next) && global.running == ICE_RUNNING);
return -1;
}
示例5: stats_event_conv
/* wrapper for stats_event, this takes a charset to convert from */
void stats_event_conv(const char *mount, const char *name, const char *value, const char *charset)
{
const char *metadata = value;
xmlBufferPtr conv = xmlBufferCreate ();
if (charset && value)
{
xmlCharEncodingHandlerPtr handle = xmlFindCharEncodingHandler (charset);
if (handle)
{
xmlBufferPtr raw = xmlBufferCreate ();
xmlBufferAdd (raw, (const xmlChar *)value, strlen (value));
if (xmlCharEncInFunc (handle, conv, raw) > 0)
metadata = (char *)xmlBufferContent (conv);
xmlBufferFree (raw);
xmlCharEncCloseFunc (handle);
}
else
WARN1 ("No charset found for \"%s\"", charset);
}
stats_event (mount, name, metadata);
xmlBufferFree (conv);
}
示例6: _add_stats_to_stats_client
static void _add_stats_to_stats_client (client_t *client, const char *fmt, va_list ap)
{
event_listener_t *listener = client->shared_data;
refbuf_t *r = listener->recent_block;
if (r && (r->flags & STATS_BLOCK_CONNECTION) == 0)
{
/* lets see if we can append to an existing block */
if (r->len < 1390)
{
int written = _append_to_bufferv (r, 1400, fmt, ap);
if (written > 0)
{
listener->content_len += written;
return;
}
}
}
r = refbuf_new (1400);
r->len = 0;
if (_append_to_bufferv (r, 1400, fmt, ap) < 0)
{
WARN1 ("stat details are too large \"%s\"", fmt);
refbuf_release (r);
return;
}
_add_node_to_stats_client (client, r);
client->schedule_ms = 0;
}
示例7: fserve_move_listener
static int fserve_move_listener (client_t *client)
{
fh_node *fh = client->shared_data;
int ret = 0;
fbinfo f;
memset (&f, 0, sizeof (f));
if (client->refbuf && client->pos < client->refbuf->len)
client->flags |= CLIENT_HAS_INTRO_CONTENT; // treat it as a partial write needing completion
else
client_set_queue (client, NULL);
f.flags = fh->finfo.flags & (~FS_DELETE);
f.limit = fh->finfo.limit;
f.mount = fh->finfo.fallback;
f.type = fh->finfo.type;
if (move_listener (client, &f) < 0)
{
WARN1 ("moved failed, terminating listener on %s", fh->finfo.mount);
ret = -1;
}
else
{
DEBUG3 ("moved %s from %s (%d)", client->connection.ip, fh->finfo.mount, fh->finfo.flags);
ret = 0;
remove_from_fh (fh, client);
}
return ret;
}
示例8: DoClean
/*
** A "local" function of ProcessRequest(). Implements the MEMORY_CLEAN service
** by deleting all files in the memory directory that have not been accessed
** within the past #idle# seconds. Returns 1 if successful, else 0.
*/
static int
DoClean(unsigned long idle) {
struct dirent *entry;
DIR *directory;
time_t expiration;
char filePath[255 + 1];
struct stat fileStat;
char *namePlace;
directory = opendir(memoryDir);
if(directory == NULL) {
FAIL1("DoClean: unable to open directory %s\n", memoryDir);
}
expiration = (time_t)CurrentTime() - (time_t)idle;
SAFESTRCPY(filePath, memoryDir);
namePlace = filePath + strlen(filePath);
while((entry = readdir(directory)) != NULL) {
strcpy(namePlace, entry->d_name);
if(stat(filePath, &fileStat) != 0) {
WARN1("DoClean: unable to state file %s\n", filePath);
}
else if(fileStat.st_mtime < expiration) {
LOG2("DoClean: deleting %s, last modified %d\n",
filePath, fileStat.st_mtime);
(void)unlink(filePath);
}
}
(void)closedir(directory);
return(1);
}
示例9: fserve_move_listener
static int fserve_move_listener (client_t *client)
{
fh_node *fh = client->shared_data;
int ret = 0;
fbinfo f;
memset (&f, 0, sizeof (f));
client_set_queue (client, NULL);
f.flags = fh->finfo.flags & (~FS_DELETE);
f.limit = fh->finfo.limit;
f.mount = fh->finfo.fallback;
f.type = fh->finfo.type;
if (move_listener (client, &f) < 0)
{
WARN1 ("moved failed, terminating listener on %s", fh->finfo.mount);
ret = -1;
}
else
{
DEBUG3 ("moved %s from %s (%d)", client->connection.ip, fh->finfo.mount, fh->finfo.flags);
ret = 0;
remove_from_fh (fh, client);
}
return ret;
}
示例10: _handle_source_request
static void _handle_source_request (client_t *client, char *uri, int auth_style)
{
source_t *source;
INFO1("Source logging in at mountpoint \"%s\"", uri);
if (uri[0] != '/')
{
WARN0 ("source mountpoint not starting with /");
client_send_401 (client);
return;
}
if (auth_style == ICECAST_SOURCE_AUTH) {
if (connection_check_source_pass (client->parser, uri) == 0)
{
/* We commonly get this if the source client is using the wrong
* protocol: attempt to diagnose this and return an error
*/
/* TODO: Do what the above comment says */
INFO1("Source (%s) attempted to login with invalid or missing password", uri);
client_send_401(client);
return;
}
}
source = source_reserve (uri);
if (source)
{
if (auth_style == SHOUTCAST_SOURCE_AUTH) {
source->shoutcast_compat = 1;
}
source->client = client;
source->parser = client->parser;
source->con = client->con;
if (connection_complete_source (source, 1) < 0)
{
source_clear_source (source);
source_free_source (source);
}
else
{
refbuf_t *ok = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->respcode = 200;
snprintf (ok->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\n\r\n");
ok->len = strlen (ok->data);
/* we may have unprocessed data read in, so don't overwrite it */
ok->associated = client->refbuf;
client->refbuf = ok;
fserve_add_client_callback (client, source_client_callback, source);
}
}
else
{
client_send_404 (client, "Mountpoint in use");
WARN1 ("Mountpoint %s in use", uri);
}
}
示例11: get_ssl_certificate
static void get_ssl_certificate (ice_config_t *config)
{
SSL_METHOD *method;
long ssl_opts;
ssl_ok = 0;
SSL_load_error_strings(); /* readable error messages */
SSL_library_init(); /* initialize library */
method = SSLv23_server_method();
ssl_ctx = SSL_CTX_new (method);
ssl_opts = SSL_CTX_get_options (ssl_ctx);
SSL_CTX_set_options (ssl_ctx, ssl_opts|SSL_OP_NO_SSLv2);
do
{
if (config->cert_file == NULL)
break;
if (SSL_CTX_use_certificate_chain_file (ssl_ctx, config->cert_file) <= 0)
{
WARN1 ("Invalid cert file %s", config->cert_file);
break;
}
if (SSL_CTX_use_PrivateKey_file (ssl_ctx, config->cert_file, SSL_FILETYPE_PEM) <= 0)
{
WARN1 ("Invalid private key file %s", config->cert_file);
break;
}
if (!SSL_CTX_check_private_key (ssl_ctx))
{
ERROR1 ("Invalid %s - Private key does not match cert public key", config->cert_file);
break;
}
if (SSL_CTX_set_cipher_list(ssl_ctx, config->cipher_list) <= 0)
{
WARN1 ("Invalid cipher list: %s", config->cipher_list);
}
ssl_ok = 1;
INFO1 ("SSL certificate found at %s", config->cert_file);
INFO1 ("SSL using ciphers %s", config->cipher_list);
return;
} while (0);
INFO0 ("No SSL capability on any configured ports");
}
示例12: source_startup
void source_startup (client_t *client, const char *uri, int auth_style)
{
source_t *source;
refbuf_t *ok;
source = source_reserve (uri);
if (!source) {
client_send_403 (client, "Mountpoint in use");
WARN1 ("Mountpoint %s in use", uri);
return;
}
source->client = client;
source->parser = client->parser;
source->con = client->con;
if (connection_complete_source (source, 1) < 0) {
source_clear_source (source);
source_free_source (source);
return;
}
client->respcode = 200;
switch (auth_style) {
case SHOUTCAST_SOURCE_AUTH:
source->shoutcast_compat = 1;
case NOAUTH_SOURCE_AUTH:
break;
case ICECAST_SOURCE_AUTH:
ok = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->respcode = 200;
snprintf (ok->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\n\r\n");
ok->len = strlen (ok->data);
/* we may have unprocessed data read in, so don't overwrite it */
ok->associated = client->refbuf;
client->refbuf = ok;
break;
default:
WARN1("Got unkown source auth type: %d", auth_style);
return;
}
fserve_add_client_callback (client, source_client_callback, source);
}
示例13: stream_auth_callback
/* Called from auth thread to process any request for source client
* authentication. Only applies to source clients, not relays.
*/
static void stream_auth_callback (auth_client *auth_user)
{
client_t *client = auth_user->client;
if (auth_user->auth->stream_auth)
auth_user->auth->stream_auth (auth_user);
if (client->flags & CLIENT_AUTHENTICATED)
auth_postprocess_source (auth_user);
else
WARN1 ("Failed auth for source \"%s\"", auth_user->mount);
}
示例14: command_list_log
static int command_list_log (client_t *client, int response)
{
refbuf_t *content;
const char *logname = httpp_get_query_param (client->parser, "log");
int log = -1;
ice_config_t *config;
if (logname == NULL)
return client_send_400 (client, "No log specified");
config = config_get_config ();
if (strcmp (logname, "errorlog") == 0)
log = config->error_log.logid;
else if (strcmp (logname, "accesslog") == 0)
log = config->access_log.logid;
else if (strcmp (logname, "playlistlog") == 0)
log = config->playlist_log.logid;
if (log < 0)
{
config_release_config();
WARN1 ("request to show unknown log \"%s\"", logname);
return client_send_400 (client, "unknown");
}
content = refbuf_new (0);
log_contents (log, &content->data, &content->len);
config_release_config();
if (response == XSLT)
{
xmlNodePtr xmlnode;
xmlDocPtr doc;
doc = xmlNewDoc(XMLSTR("1.0"));
xmlnode = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
xmlDocSetRootElement(doc, xmlnode);
xmlNewTextChild (xmlnode, NULL, XMLSTR("log"), XMLSTR(content->data));
refbuf_release (content);
return admin_send_response (doc, client, XSLT, "showlog.xsl");
}
else
{
refbuf_t *http = refbuf_new (100);
int len = snprintf (http->data, 100, "%s",
"HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n");
http->len = len;
http->next = content;
client->respcode = 200;
client_set_queue (client, http);
return fserve_setup_client (client);
}
}
示例15: mp3_set_title
/* called from the source thread when the metadata has been updated.
* The artist title are checked and made ready for clients to send
*/
static void mp3_set_title (source_t *source)
{
const char meta[] = "StreamTitle='";
int size;
unsigned char len_byte;
refbuf_t *p;
unsigned int len = sizeof(meta) + 2; /* the StreamTitle, quotes, ; and null */
mp3_state *source_mp3 = source->format->_state;
/* make sure the url data does not disappear from under us */
thread_mutex_lock (&source_mp3->url_lock);
/* work out message length */
if (source_mp3->url_artist)
len += strlen (source_mp3->url_artist);
if (source_mp3->url_title)
len += strlen (source_mp3->url_title);
if (source_mp3->url_artist && source_mp3->url_title)
len += 3;
#define MAX_META_LEN 255*16
if (len > MAX_META_LEN)
{
thread_mutex_unlock (&source_mp3->url_lock);
WARN1 ("Metadata too long at %d chars", len);
return;
}
/* work out the metadata len byte */
len_byte = (len-1) / 16 + 1;
/* now we know how much space to allocate, +1 for the len byte */
size = len_byte * 16 + 1;
p = refbuf_new (size);
if (p)
{
mp3_state *source_mp3 = source->format->_state;
memset (p->data, '\0', size);
if (source_mp3->url_artist && source_mp3->url_title)
snprintf (p->data, size, "%c%s%s - %s';", len_byte, meta,
source_mp3->url_artist, source_mp3->url_title);
else
snprintf (p->data, size, "%c%s%s';", len_byte, meta,
source_mp3->url_title);
filter_shoutcast_metadata (source, p->data, size);
refbuf_release (source_mp3->metadata);
source_mp3->metadata = p;
}
thread_mutex_unlock (&source_mp3->url_lock);
}