Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] mongoose, progress: resolve 'Restart System' from web UI IPC event #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions mongoose/mongoose_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,12 @@ static const char *get_source_string(unsigned int source)

static void restart_handler(struct mg_connection *nc, void *ev_data)
{
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
ipc_message msg = {};
struct mg_http_message* hm = (struct mg_http_message*)ev_data;
ipc_message msg;

size_t size = sizeof(msg.data.procmsg.buf);
snprintf(msg.data.procmsg.buf, size, "{\"reboot\": \"true\"}");
msg.data.procmsg.len = strnlen(msg.data.procmsg.buf, size);

if(mg_strcasecmp(hm->method, mg_str("POST")) != 0) {
mg_http_reply(nc, 405, "", "%s", "Method Not Allowed\n");
Expand Down
3 changes: 3 additions & 0 deletions tools/swupdate-progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ int main(int argc, char **argv)
break;
case DONE:
fprintf(stdout, "\nDONE.\n\n");
if (opt_r && strcasestr(msg.info, "\"reboot\": \"true\"")) {
reboot_device();
}
break;
case PROGRESS:
/*
Expand Down
Loading