Browse Source

corex: rpc corex.list_sockets prints advertise as full socket string

- new field to print socket string field also for bind address
Daniel-Constantin Mierla 1 year ago
parent
commit
54868f83f0
1 changed files with 12 additions and 10 deletions
  1. 12 10
      src/modules/corex/corex_rpc.c

+ 12 - 10
src/modules/corex/corex_rpc.c

@@ -86,12 +86,14 @@ static void corex_rpc_list_sockets(rpc_t *rpc, void *ctx)
 				}
 			}
 
-			if(rpc->struct_add(th, "ssssss", "port", si->port_no_str.s, "mcast",
-					   si->flags & SI_IS_MCAST ? "yes" : "no", "mhomed",
-					   si->flags & SI_IS_MHOMED ? "yes" : "no", "virtual",
-					   si->flags & SI_IS_VIRTUAL ? "yes" : "no", "sockname",
-					   si->sockname.s ? si->sockname.s : "-", "advertise",
-					   si->useinfo.name.s ? si->useinfo.name.s : "-")
+			if(rpc->struct_add(th, "sssssss", "port", si->port_no_str.s,
+					   "sockstr", si->sock_str.s ? si->sock_str.s : "-",
+					   "mcast", si->flags & SI_IS_MCAST ? "yes" : "no",
+					   "mhomed", si->flags & SI_IS_MHOMED ? "yes" : "no",
+					   "virtual", si->flags & SI_IS_VIRTUAL ? "yes" : "no",
+					   "sockname", si->sockname.s ? si->sockname.s : "-",
+					   "advertise",
+					   si->useinfo.sock_str.s ? si->useinfo.sock_str.s : "-")
 					< 0) {
 				rpc->fault(ctx, 500, "Internal error attrs structure");
 				return;
@@ -251,19 +253,19 @@ static void corex_rpc_debug(rpc_t *rpc, void *ctx)
 	}
 }
 
-/*clang-format off*/
+/* clang-format off */
 rpc_export_t corex_rpc_cmds[] = {
 	{"corex.list_sockets", corex_rpc_list_sockets,
-			corex_rpc_list_sockets_doc, RET_ARRAY},
+		corex_rpc_list_sockets_doc, RET_ARRAY},
 	{"corex.list_aliases", corex_rpc_list_aliases,
-			corex_rpc_list_aliases_doc, RET_ARRAY},
+		corex_rpc_list_aliases_doc, RET_ARRAY},
 	{"corex.shm_status", corex_rpc_shm_status, corex_rpc_shm_status_doc, 0},
 	{"corex.shm_summary", corex_rpc_shm_summary, corex_rpc_shm_summary_doc, 0},
 	{"corex.pkg_summary", corex_rpc_pkg_summary, corex_rpc_pkg_summary_doc, 0},
 	{"corex.debug", corex_rpc_debug, corex_rpc_debug_doc, 0},
 	{0, 0, 0, 0}
 };
-/*clang-format on*/
+/* clang-format on */
 
 /**
  * register RPC commands