diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2020-04-14 12:31:35 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-06-02 12:32:36 +0200 |
commit | f5fa6dd4d39df97db57cd018929a9fdec1fa5e1b (patch) | |
tree | f17fec6ec088f7997a92ce87bf8bb5e02f294343 | |
parent | fcb23dceed6dd6b9ff2234f0c32028476c189a9c (diff) |
#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.
-rw-r--r-- | admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c | 32 |
1 files changed, 7 insertions, 25 deletions
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) |