chiark / gitweb /
fake rng: at-otter: Actually use fake rng
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Mar 2021 18:25:43 +0000 (18:25 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Mar 2021 19:07:58 +0000 (19:07 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest.rs
apitest/at-otter.rs
daemon/cmdlistener.rs
src/commands.rs

index a8a7a6b64ca61a9950e921e5c5a57948640e5454..eea5acf29761288daa414893ff673e15ac9efde2 100644 (file)
@@ -18,6 +18,8 @@ pub use num_traits::NumCast;
 pub use serde_json::json;
 pub use structopt::StructOpt;
 
+pub type MC = MgmtCommand;
+
 // -------------------- private imports ----------
 
 use otter::config::DAEMON_STARTUP_REPORT;
index cb9d6752d10b5c096761349f8c881efe809e7812..9ed9d346565785cc26b871924719693295c4f2be 100644 (file)
@@ -321,6 +321,7 @@ impl Ctx {
   fn hidden_hand(&mut self) {
     prepare_game(&self.ds, TABLE)?;
     let mut session = self.connect_player(&self.alice)?;
+    self.su.mgmt_conn.cmd(&MC::LoadFakeRng(vec![ "1".to_owned() ]))?;
 
     let pieces = session.pieces()?;
 
@@ -349,6 +350,8 @@ impl Ctx {
     }))?;
 
     session.synch(&mut self.su)?;
+
+    self.su.mgmt_conn.cmd(&MC::LoadFakeRng(vec![]))?;
   }
 }
 
index d02d6cb9a85315b05f6d92bf6d0b3ede02454ea8..a9c576384ffe2ce2a2a840e18568e4e89f00b8aa 100644 (file)
@@ -215,7 +215,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse {
       MR::LibraryItems(results)
     }
 
-    MC::SetFakeRng { ents } => {
+    MC::LoadFakeRng(ents) => {
       let superuser = cs.superuser
         .ok_or(ME::SuperuserAuthorisationRequired)?;
       config().fake_rng.set(ents, superuser)?;
index 5578ca25c06d8994a54dddefdfb49948e9c57a50..2ba0c286110067b74cd6654f80e7df6623234344 100644 (file)
@@ -43,7 +43,7 @@ pub enum MgmtCommand {
     glob: shapelib::ItemSpec,
   },
 
-  SetFakeRng { ents: Vec<String> },
+  LoadFakeRng(Vec<String>),
 }
 
 //---------- Accounts file ----------