MINOR: server/event_hdl: expose updater info through INETADDR event

Thanks to the previous commit, we can now expose updater info through
INETADDR event.
This commit is contained in:
Aurelien DARRAGON 2023-12-11 17:14:24 +01:00 committed by Christopher Faulet
parent 3ac79b504a
commit 33cd676e9e
2 changed files with 8 additions and 2 deletions

View File

@ -669,6 +669,7 @@ struct event_hdl_cb_data_server_inetaddr {
struct { struct {
struct server_inetaddr prev; struct server_inetaddr prev;
struct server_inetaddr next; struct server_inetaddr next;
struct server_inetaddr_updater updater;
} safe; } safe;
/* no unsafe data */ /* no unsafe data */
}; };

View File

@ -436,7 +436,8 @@ void _srv_event_hdl_prepare_state(struct event_hdl_cb_data_server_state *cb_data
*/ */
static void _srv_event_hdl_prepare_inetaddr(struct event_hdl_cb_data_server_inetaddr *cb_data, static void _srv_event_hdl_prepare_inetaddr(struct event_hdl_cb_data_server_inetaddr *cb_data,
struct server *srv, struct server *srv,
const struct server_inetaddr *next_inetaddr) const struct server_inetaddr *next_inetaddr,
struct server_inetaddr_updater updater)
{ {
struct server_inetaddr prev_inetaddr; struct server_inetaddr prev_inetaddr;
@ -451,6 +452,9 @@ static void _srv_event_hdl_prepare_inetaddr(struct event_hdl_cb_data_server_inet
/* next */ /* next */
cb_data->safe.next = *next_inetaddr; cb_data->safe.next = *next_inetaddr;
/* updater */
cb_data->safe.updater = updater;
} }
/* server event publishing helper: publish in both global and /* server event publishing helper: publish in both global and
@ -3945,7 +3949,8 @@ int server_set_inetaddr(struct server *s,
if (ip_change || port_change) { if (ip_change || port_change) {
_srv_event_hdl_prepare(&cb_data.common, s, 0); _srv_event_hdl_prepare(&cb_data.common, s, 0);
_srv_event_hdl_prepare_inetaddr(&cb_data.addr, s, _srv_event_hdl_prepare_inetaddr(&cb_data.addr, s,
inetaddr); inetaddr,
updater);
/* server_atomic_sync_task will apply the changes for us */ /* server_atomic_sync_task will apply the changes for us */
_srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_INETADDR, cb_data, s); _srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_INETADDR, cb_data, s);