mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 02:40:14 +00:00
Reflector: report received bytes
+ some small improvements
This commit is contained in:
@@ -20,6 +20,8 @@ struct response *send_message(struct module *root, const char *const_path, struc
|
||||
*/
|
||||
|
||||
if(receiver == NULL) {
|
||||
fprintf(stderr, "%s not found:\n", const_path);
|
||||
dump_tree(root, 0);
|
||||
snprintf(buf, sizeof(buf), "(path: %s)", const_path);
|
||||
return new_response(RESPONSE_NOT_FOUND, strdup(buf));
|
||||
}
|
||||
@@ -42,11 +44,12 @@ struct response *send_message(struct module *root, const char *const_path, struc
|
||||
|
||||
struct response *send_message_to_receiver(struct module *receiver, struct message *msg)
|
||||
{
|
||||
lock_guard guard(receiver->lock);
|
||||
if(receiver->msg_callback) {
|
||||
lock_guard guard(receiver->lock);
|
||||
return receiver->msg_callback(receiver, msg);
|
||||
} else {
|
||||
return new_response(RESPONSE_NOT_IMPL, NULL);
|
||||
simple_linked_list_append(receiver->msg_queue, msg);
|
||||
return new_response(RESPONSE_ACCEPTED, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,3 +117,16 @@ const char *response_status_to_text(int status)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct message *check_message(struct module *mod)
|
||||
{
|
||||
struct message *ret;
|
||||
|
||||
lock_guard guard(mod->lock);
|
||||
|
||||
if(simple_linked_list_size(mod->msg_queue) > 0) {
|
||||
return (struct message *) simple_linked_list_pop(mod->msg_queue);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user