]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Cache answers to previous questions instead of freeing them
authorRay Strode <rstrode@redhat.com>
Tue, 19 Aug 2008 20:54:35 +0000 (16:54 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 20 Aug 2008 19:50:24 +0000 (15:50 -0400)
We'll probably need to mark the answers in some way if we ever end
up getting asked a question other than "what's the password?"

src/ply-boot-server.c

index 6e39f86434f7d0bd8206658c2630dc7c962c477b..aeaf78efe833cb5ae442db3f241fc9e42be20e32 100644 (file)
@@ -47,6 +47,7 @@ struct _ply_boot_server
 {
   ply_event_loop_t *loop;
   ply_list_t *connections;
+  ply_list_t *cached_answers;
   int socket_fd;
 
   ply_boot_server_update_handler_t update_handler;
@@ -77,6 +78,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t  update_handler,
 
   server = calloc (1, sizeof (ply_boot_server_t));
   server->connections = ply_list_new ();
+  server->cached_answers = ply_list_new ();
   server->loop = NULL;
   server->is_listening = false;
   server->update_handler = update_handler;
@@ -99,6 +101,7 @@ ply_boot_server_free (ply_boot_server_t *server)
     return;
 
   ply_list_free (server->connections);
+  ply_list_free (server->cached_answers);
   free (server);
 }
 
@@ -226,7 +229,7 @@ ply_boot_connection_on_password_answer (ply_boot_connection_t *connection,
           ply_error ("could not write bytes: %m");
     }
 
-  ply_answer_free (answer);
+  ply_list_append_data (connection->server->cached_answers, answer);
 }
 
 static void