pulse-server: debug messages when connection debug enabled

This commit is contained in:
Wim Taymans 2020-11-03 12:22:35 +01:00
parent bba24b9ff8
commit efafb41525
3 changed files with 186 additions and 1 deletions

View file

@ -42,6 +42,10 @@
#include <pwd.h>
#endif
#include <pipewire/log.h>
#define spa_debug pw_log_debug
#include <spa/utils/result.h>
#include <spa/debug/dict.h>
#include <spa/debug/mem.h>
@ -63,6 +67,8 @@
#define NAME "pulse-server"
static bool debug_messages = false;
struct impl;
struct server;
@ -299,6 +305,10 @@ static int send_message(struct client *client, struct message *m)
m->offset = 0;
spa_list_append(&client->out_messages, &m->link);
if (debug_messages)
message_dump(m);
res = flush_messages(client);
if (res == -EAGAIN) {
int mask = client->source->mask;
@ -3888,8 +3898,13 @@ static int handle_packet(struct client *client, struct message *msg)
if (command >= COMMAND_MAX) {
res = -EINVAL;
goto finish;
}
if (debug_messages) {
pw_log_debug(NAME" %p: command %s", impl, commands[command].name);
message_dump(msg);
}
if (commands[command].run == NULL) {
res = -ENOTSUP;
goto finish;
@ -4386,6 +4401,8 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
if (impl == NULL)
return NULL;
debug_messages = pw_debug_is_category_enabled("connection");
impl->context = context;
impl->loop = pw_context_get_main_loop(context);
impl->props = props;