本文整理汇总了C++中client_set_queue函数的典型用法代码示例。如果您正苦于以下问题:C++ client_set_queue函数的具体用法?C++ client_set_queue怎么用?C++ client_set_queue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了client_set_queue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: client_read_bytes
/* helper function for reading data from a client */
int client_read_bytes (client_t *client, void *buf, unsigned len)
{
int (*con_read)(struct connection_tag *handle, void *buf, size_t len) = connection_read;
int bytes;
if (len == 0)
return 0;
if (client->refbuf && client->pos < client->refbuf->len)
{
unsigned remaining = client->refbuf->len - client->pos;
if (remaining > len)
remaining = len;
memcpy (buf, client->refbuf->data + client->pos, remaining);
client->pos += remaining;
if (client->pos >= client->refbuf->len)
client_set_queue (client, NULL);
return remaining;
}
#ifdef HAVE_OPENSSL
if (client->connection.ssl)
con_read = connection_read_ssl;
#endif
bytes = con_read (&client->connection, buf, len);
if (bytes == -1 && client->connection.error)
DEBUG0 ("reading from connection has failed");
return bytes;
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:30,代码来源:client.c
示例2: client_send_404
int client_send_404 (client_t *client, const char *message)
{
int ret = -1;
if (client->worker == NULL) /* client is not on any worker now */
{
client_destroy (client);
return 0;
}
client_set_queue (client, NULL);
if (client->respcode)
{
worker_t *worker = client->worker;
if (client->respcode >= 300)
client->flags = client->flags & ~CLIENT_AUTHENTICATED;
client->flags |= CLIENT_ACTIVE;
worker_wakeup (worker);
}
else
{
if (client->parser->req_type == httpp_req_head || message == NULL)
message = "Not Available";
ret = strlen (message);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 404 Not Available\r\n"
"%s\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n"
"%s", client_keepalive_header (client), ret,
message ? message: "");
client->respcode = 404;
client->refbuf->len = strlen (client->refbuf->data);
ret = fserve_setup_client (client);
}
return ret;
}
开发者ID:8Media,项目名称:icecast-kh,代码行数:35,代码来源:client.c
示例3: find_client_start
/* 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)
{
refbuf_t *refbuf = source->burst_point;
/* we only want to attempt a burst at connection time, not midstream */
if (client->intro_offset == -1)
refbuf = source->stream_data_tail;
else
{
long size = 0;
refbuf = source->burst_point;
size = client->intro_offset;
while (size > 0 && refbuf->next)
{
size -= refbuf->len;
refbuf = refbuf->next;
}
}
while (refbuf)
{
if (refbuf->sync_point)
{
client_set_queue (client, refbuf);
client->check_buffer = format_advance_queue;
client->write_to_client = source->format->write_buf_to_client;
client->intro_offset = -1;
break;
}
refbuf = refbuf->next;
}
}
开发者ID:kitsune-dsu,项目名称:kitsune-icecast,代码行数:35,代码来源:format.c
示例4: 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;
}
开发者ID:roderickm,项目名称:icecast-kh,代码行数:25,代码来源:fserve.c
示例5: 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;
}
开发者ID:onitake,项目名称:icecast-kh,代码行数:28,代码来源:fserve.c
示例6: file_release
static void file_release (client_t *client)
{
fh_node *fh = client->shared_data;
int ret = -1;
if (fh->finfo.flags & FS_FALLBACK)
stats_event_dec (NULL, "listeners");
remove_from_fh (fh, client);
client_set_queue (client, NULL);
if (client->flags & CLIENT_AUTHENTICATED && client->parser->req_type == httpp_req_get)
{
const char *mount = httpp_getvar (client->parser, HTTPP_VAR_URI);
ice_config_t *config = config_get_config ();
mount_proxy *mountinfo = config_find_mount (config, mount);
if (mountinfo && mountinfo->access_log.name)
logging_access_id (&mountinfo->access_log, client);
ret = auth_release_listener (client, mount, mountinfo);
config_release_config();
}
if (ret < 0)
{
client->flags &= ~CLIENT_AUTHENTICATED;
client_destroy (client);
}
global_reduce_bitrate_sampling (global.out_bitrate);
}
开发者ID:roderickm,项目名称:icecast-kh,代码行数:28,代码来源:fserve.c
示例7: client_send_404
int client_send_404 (client_t *client, const char *message)
{
int ret = -1;
if (client->worker == NULL) /* client is not on any worker now */
{
client_destroy (client);
return 0;
}
client_set_queue (client, NULL);
if (client->respcode)
{
worker_t *worker = client->worker;
if (client->respcode >= 300)
client->flags = client->flags & ~CLIENT_AUTHENTICATED;
client->flags |= CLIENT_ACTIVE;
worker_wakeup (worker);
}
else
{
if (message == NULL)
message = "Not Available";
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 404 Not Available\r\n"
"Content-Type: text/html\r\n\r\n"
"<b>%s</b>\r\n", message);
client->respcode = 404;
client->refbuf->len = strlen (client->refbuf->data);
ret = fserve_setup_client (client);
}
return ret;
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:33,代码来源:client.c
示例8: find_client_start
/* 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)
{
refbuf_t *refbuf = source->burst_point;
/* we only want to attempt a burst at connection time, not midstream
* however streams like theora may not have the most recent page marked as
* a starting point, so look for one from the burst point */
if (client->intro_offset == -1 && source->stream_data_tail
&& source->stream_data_tail->sync_point)
refbuf = source->stream_data_tail;
else
{
size_t size = client->intro_offset;
refbuf = source->burst_point;
while (size > 0 && refbuf && refbuf->next)
{
size -= refbuf->len;
refbuf = refbuf->next;
}
}
while (refbuf)
{
if (refbuf->sync_point)
{
client_set_queue (client, refbuf);
client->check_buffer = format_advance_queue;
client->write_to_client = source->format->write_buf_to_client;
client->intro_offset = -1;
break;
}
refbuf = refbuf->next;
}
}
开发者ID:Boltsie,项目名称:Icecast-Server,代码行数:37,代码来源:format.c
示例9: command_list_mounts
int command_list_mounts(client_t *client, int response)
{
DEBUG0("List mounts request");
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
if (response == TEXT)
{
redirector_update (client);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n");
client->refbuf->len = strlen (client->refbuf->data);
client->respcode = 200;
if (strcmp (httpp_getvar (client->parser, HTTPP_VAR_URI), "/admin/streams") == 0)
client->refbuf->next = stats_get_streams (1);
else
client->refbuf->next = stats_get_streams (0);
return fserve_setup_client (client);
}
else
{
xmlDocPtr doc;
avl_tree_rlock (global.source_tree);
doc = admin_build_sourcelist(NULL);
avl_tree_unlock (global.source_tree);
return admin_send_response (doc, client, response, "listmounts.xsl");
}
}
开发者ID:MechanisM,项目名称:icecast-kh,代码行数:31,代码来源:admin.c
示例10: format_file_read
int format_file_read (client_t *client, format_plugin_t *plugin, FILE *fp)
{
refbuf_t *refbuf = client->refbuf;
size_t bytes = -1;
int unprocessed = 0;
do
{
if (refbuf == NULL)
{
if (fp == NULL)
return -2;
refbuf = client->refbuf = refbuf_new (4096);
client->pos = refbuf->len;
client->intro_offset = 0;
client->queue_pos = 0;
}
if (client->pos < refbuf->len)
break;
if (fp == NULL || client->flags & CLIENT_HAS_INTRO_CONTENT)
{
if (refbuf->next)
{
//DEBUG1 ("next intro block is %d", refbuf->next->len);
client->refbuf = refbuf->next;
refbuf->next = NULL;
refbuf_release (refbuf);
client->pos = 0;
return 0;
}
//DEBUG0 ("No more intro data ");
client_set_queue (client, NULL);
client->flags &= ~CLIENT_HAS_INTRO_CONTENT;
client->intro_offset = client->connection.sent_bytes;
refbuf = NULL;
continue;
}
if (fseek (fp, client->intro_offset, SEEK_SET) < 0 ||
(bytes = fread (refbuf->data, 1, 4096, fp)) <= 0)
{
return bytes < 0 ? -2 : -1;
}
refbuf->len = bytes;
client->pos = 0;
if (plugin->align_buffer)
{
/* here the buffer may require truncating to keep the buffers aligned on
* certain boundaries */
unprocessed = plugin->align_buffer (client, plugin);
if (unprocessed < 0 || unprocessed >= bytes)
unprocessed = 0;
}
client->intro_offset += (bytes - unprocessed);
} while (1);
return 0;
}
开发者ID:MechanisM,项目名称:icecast-kh,代码行数:57,代码来源:format.c
示例11: stats_callback
void stats_callback (client_t *client, void *notused)
{
if (client->con->error)
{
client_destroy (client);
return;
}
client_set_queue (client, NULL);
thread_create("Stats Connection", stats_connection, (void *)client, THREAD_DETACHED);
}
开发者ID:andreaperizzato,项目名称:Icecast-Server,代码行数:10,代码来源:stats.c
示例12: client_send_416
int client_send_416(client_t *client)
{
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
client->respcode = 416;
client->refbuf->len = strlen (client->refbuf->data);
return fserve_setup_client (client);
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:10,代码来源:client.c
示例13: client_send_501
int client_send_501(client_t *client)
{
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 501 Not Implemented\r\n\r\n");
client->respcode = 501;
client->refbuf->len = strlen (client->refbuf->data);
return fserve_setup_client (client);
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:10,代码来源:client.c
示例14: client_send_400
int client_send_400(client_t *client, const char *message)
{
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 400 Bad Request\r\n"
"Content-Type: text/html\r\n\r\n"
"<b>%s</b>\r\n", message?message:"");
client->respcode = 400;
client->refbuf->len = strlen (client->refbuf->data);
return fserve_setup_client (client);
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:12,代码来源:client.c
示例15: 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);
}
}
开发者ID:MechanisM,项目名称:icecast-kh,代码行数:53,代码来源:admin.c
示例16: client_send_403
int client_send_403(client_t *client, const char *reason)
{
if (reason == NULL)
reason = "Forbidden";
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 403 %s\r\n"
"Content-Type: text/html\r\n\r\n", reason);
client->respcode = 403;
client->refbuf->len = strlen (client->refbuf->data);
return fserve_setup_client (client);
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:13,代码来源:client.c
示例17: client_send_302
int client_send_302(client_t *client, const char *location)
{
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 302 Temporarily Moved\r\n"
"Content-Type: text/html\r\n"
"Location: %s\r\n\r\n"
"Moved <a href=\"%s\">here</a>\r\n", location, location);
client->respcode = 302;
client->refbuf->len = strlen (client->refbuf->data);
return fserve_setup_client (client);
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:13,代码来源:client.c
示例18: client_send_options
int client_send_options(client_t *client)
{
client_set_queue (client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.1 200 OK\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type\r\n"
"Access-Control-Allow-Methods: GET, OPTIONS, STATS\r\n\r\n");
client->respcode = 200;
client->refbuf->len = strlen (client->refbuf->data);
return fserve_setup_client (client);
}
开发者ID:Johnny-Cache,项目名称:icecast-kh,代码行数:13,代码来源:client.c
示例19: find_client_start
/* clients need to be start from somewhere in the queue
* * so we will look for a refbuf which has been previous
* * marked as a sync point */
static void find_client_start (source_t *source, client_t *client)
{
refbuf_t *refbuf = source->burst_point;
while (refbuf)
{
if (refbuf->sync_point)
{
client_set_queue (client, refbuf);
break;
}
refbuf = refbuf->next;
}
}
开发者ID:miksago,项目名称:icecast,代码行数:17,代码来源:source.c
示例20: xslt_transform
void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
{
xmlDocPtr res;
xsltStylesheetPtr cur;
xmlChar *string;
int len, problem = 0;
xmlSetGenericErrorFunc ("", log_parse_failure);
xsltSetGenericErrorFunc ("", log_parse_failure);
thread_mutex_lock(&xsltlock);
cur = xslt_get_stylesheet(xslfilename);
if (cur == NULL)
{
thread_mutex_unlock(&xsltlock);
ERROR1 ("problem reading stylesheet \"%s\"", xslfilename);
client_send_404 (client, "Could not parse XSLT file");
return;
}
res = xsltApplyStylesheet(cur, doc, NULL);
if (xsltSaveResultToString (&string, &len, res, cur) < 0)
problem = 1;
thread_mutex_unlock(&xsltlock);
if (problem == 0)
{
const char *http = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nContent-Length: ";
int buf_len = strlen (http) + 20 + len;
if (string == NULL)
string = xmlStrdup ("");
client->respcode = 200;
client_set_queue (client, NULL);
client->refbuf = refbuf_new (buf_len);
len = snprintf (client->refbuf->data, buf_len, "%s%d\r\n\r\n%s", http, len, string);
client->refbuf->len = len;
fserve_add_client (client, NULL);
xmlFree (string);
}
else
{
WARN1 ("problem applying stylesheet \"%s\"", xslfilename);
client_send_404 (client, "XSLT problem");
}
xmlFreeDoc(res);
}
开发者ID:kitsune-dsu,项目名称:kitsune-icecast,代码行数:48,代码来源:xslt.c
注:本文中的client_set_queue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论