Commit de9722a3 authored by Josh Kunz's avatar Josh Kunz

Add some broker debug code

parent 3c056bcc
Pipeline #2137 passed with stage
in 40 seconds
......@@ -2282,6 +2282,16 @@ static int __cn_broker_try_lookup(struct cnode * broker, char * name, GList * wa
return 0;
}
static void __debug_print_broker_registry(cn_broker_t * b) {
GHashTableIter iter;
gpointer key, value;
cncinfo("Broker Registry:\n");
g_hash_table_iter_init(&iter, b->registry);
while (g_hash_table_iter_next(&iter, &key, &value)) {
cncinfo("%s\n", (char *) key);
}
}
int cn_broker_register(struct cnode *broker, char *service_name, cptr_t rp_cap) {
cn_broker_t *real_broker;
......@@ -2301,6 +2311,8 @@ int cn_broker_register(struct cnode *broker, char *service_name, cptr_t rp_cap)
goto finish;
g_hash_table_insert(real_broker->registry,strdup(service_name),e);
__debug_print_broker_registry(real_broker);
if (g_hash_table_contains(real_broker->waiting, service_name)) {
GList * waiters = g_hash_table_lookup(real_broker->waiting, service_name);
(void) __cn_broker_try_lookup(broker, service_name, waiters);
......@@ -2325,6 +2337,9 @@ int cn_broker_lookup(struct cnode *broker, char *service_name, cptr_t *rp_cap) {
}
real_broker = (cn_broker_t *)cn_cnode_object(broker);
cn_obj_lock(real_broker);
__debug_print_broker_registry(real_broker);
e = (struct cn_broker_elem *)g_hash_table_lookup(real_broker->registry,
service_name);
if (!e) {
......@@ -2365,6 +2380,8 @@ int cn_broker_lookup_wait(struct cnode *broker, char *service_name, uint64_t uui
goto finish;
}
__debug_print_broker_registry(b);
GList * waiting = NULL;
if (g_hash_table_contains(b->waiting, service_name)) {
waiting = (GList *) g_hash_table_lookup(b->waiting, service_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment