MINOR: server/event_hdl: add proxy_uuid to event_hdl_cb_data_server

Expose proxy_uuid variable in event_hdl_cb_data_server struct to
overcome proxy_name fixed length limitation.

proxy_uuid may be used by the handler to perform proxy lookups.
This should be preferred over lookups relying proxy_name.
(proxy_name is suitable for printing / logging purposes but not for
ID lookups since it has a maximum fixed length)
This commit is contained in:
Aurelien DARRAGON 2023-03-22 17:35:47 +01:00 committed by Christopher Faulet
parent 0ddf052972
commit d714213862
2 changed files with 6 additions and 1 deletions

View File

@ -429,6 +429,7 @@ struct event_hdl_cb_data_server {
*/
char name[64]; /* server name/id */
char proxy_name[64]; /* id of proxy the server belongs to */
int proxy_uuid; /* uuid of the proxy the server belongs to */
int puid; /* proxy-unique server ID */
uint32_t rid; /* server id revision */
unsigned int flags; /* server flags */

View File

@ -151,8 +151,12 @@ static inline void srv_event_hdl_publish(struct event_hdl_sub_type event, struct
cb_data.safe.rid = srv->rid;
cb_data.safe.flags = srv->flags;
snprintf(cb_data.safe.name, sizeof(cb_data.safe.name), "%s", srv->id);
if (srv->proxy)
cb_data.safe.proxy_name[0] = '\0';
cb_data.safe.proxy_uuid = -1; /* default value */
if (srv->proxy) {
cb_data.safe.proxy_uuid = srv->proxy->uuid;
snprintf(cb_data.safe.proxy_name, sizeof(cb_data.safe.proxy_name), "%s", srv->proxy->id);
}
/* unsafe data assignments */
cb_data.unsafe.ptr = srv;
cb_data.unsafe.thread_isolate = thread_isolate;