From f5fa6dd4d39df97db57cd018929a9fdec1fa5e1b Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Tue, 14 Apr 2020 12:31:35 +0200 Subject: #980 Change initial probe to refresh We have observed that an initial refresh is needed when the ogClient (in ogLive mode) connects with the ogAdmServer, to generate the HTML menu. This commit changes the probe command that was done at the beginning of the connection to a refresh command. This way the client first generates his HTML menu and the show to the user the browser with all the correct information. --- .../Services/ogAdmServer/sources/ogAdmServer.c | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'admin/Sources') diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c index f8803aa8..97ee69ae 100644 --- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c +++ b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c @@ -5371,39 +5371,20 @@ static void og_client_timer_cb(struct ev_loop *loop, ev_timer *timer, int events og_client_release(loop, cli); } -static void og_agent_send_probe(struct og_client *cli) +static void og_agent_send_refresh(struct og_client *cli) { - json_t *id, *name, *center, *room, *object; struct og_msg_params params; - struct og_computer computer; int err; - err = og_dbi_get_computer_info(&computer, cli->addr.sin_addr); - if (err < 0) - return; - params.ips_array[0] = inet_ntoa(cli->addr.sin_addr); params.ips_array_len = 1; - id = json_integer(computer.id); - center = json_integer(computer.center); - room = json_integer(computer.room); - name = json_string(computer.name); - - object = json_object(); - if (!object) - return; - json_object_set_new(object, "id", id); - json_object_set_new(object, "name", name); - json_object_set_new(object, "center", center); - json_object_set_new(object, "room", room); - - err = og_send_request(OG_METHOD_POST, OG_CMD_PROBE, ¶ms, object); + err = og_send_request(OG_METHOD_GET, OG_CMD_REFRESH, ¶ms, NULL); if (err < 0) { - syslog(LOG_ERR, "Can't send probe to: %s\n", + syslog(LOG_ERR, "Can't send refresh to: %s\n", params.ips_array[0]); } else { - syslog(LOG_INFO, "Sent probe to: %s\n", + syslog(LOG_INFO, "Sent refresh to: %s\n", params.ips_array[0]); } } @@ -5462,8 +5443,9 @@ static void og_server_accept_cb(struct ev_loop *loop, struct ev_io *io, ev_timer_start(loop, &cli->timer); list_add(&cli->list, &client_list); - if (io->fd == socket_agent_rest) - og_agent_send_probe(cli); + if (io->fd == socket_agent_rest) { + og_agent_send_refresh(cli); + } } static int og_socket_server_init(const char *port) -- cgit v1.2.3-18-g5258