X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fdiscover-server.c;h=29816ee6a3614d4ad4500b2b7d31307e43fb19dd;hp=67ce266c4c433fced328f810360094cd8e60f10f;hb=2723662cabd4d34d4155ab5d6668c591a20a086b;hpb=658d9e98eec02f92e3cf263a1bb27beb3d395b2f diff --git a/discover/discover-server.c b/discover/discover-server.c index 67ce266..29816ee 100644 --- a/discover/discover-server.c +++ b/discover/discover-server.c @@ -182,20 +182,30 @@ static int discover_server_process_message(void *arg) } - if (message->action != PB_PROTOCOL_ACTION_BOOT) { - pb_log("%s: invalid action %d\n", __func__, message->action); - return 0; - } + switch (message->action) { + case PB_PROTOCOL_ACTION_BOOT: + boot_command = talloc(client, struct boot_command); + + rc = pb_protocol_deserialise_boot_command(boot_command, + message); + if (rc) { + pb_log("%s: no boot command?", __func__); + return 0; + } + + device_handler_boot(client->server->device_handler, + boot_command); + break; - boot_command = talloc(client, struct boot_command); + case PB_PROTOCOL_ACTION_CANCEL_DEFAULT: + device_handler_cancel_default(client->server->device_handler); + break; - rc = pb_protocol_deserialise_boot_command(boot_command, message); - if (rc) { - pb_log("%s: no boot command?", __func__); + default: + pb_log("%s: invalid action %d\n", __func__, message->action); return 0; } - device_handler_boot(client->server->device_handler, boot_command); return 0; }