]> git.ozlabs.org Git - petitboot/blobdiff - discover/discover-server.c
pb-protocol: Don't allocate in deserialise functions
[petitboot] / discover / discover-server.c
index 7633134c2ea639b1ac410564465f8c2a9ca2dfee..9ec33826254f0515a79fc320aad89ca1def3f297 100644 (file)
@@ -130,7 +130,9 @@ static int write_remove_message(struct discover_server *server,
 static int discover_server_process_message(void *arg)
 {
        struct pb_protocol_message *message;
+       struct boot_command *boot_command;
        struct client *client = arg;
+       int rc;
 
        message = pb_protocol_read_message(client, client->fd);
 
@@ -142,7 +144,16 @@ static int discover_server_process_message(void *arg)
                return 0;
        }
 
-       /* todo: process boot message */
+       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);
+
        return 0;
 }