Browse Source

Clean up some compiler warnings

Ian Goldberg 1 year ago
parent
commit
5ae476d943
4 changed files with 9 additions and 24 deletions
  1. 1 0
      src/aligned_memory_mt.rs
  2. 4 8
      src/client.rs
  3. 0 8
      src/lib.rs
  4. 4 8
      src/server.rs

+ 1 - 0
src/aligned_memory_mt.rs

@@ -1,3 +1,4 @@
+#![allow(dead_code)]
 /* This file is almost identical to the aligned_memory.rs file in the
    spiral-rs crate.  The name is modified from AlignedMemory to
    AlignedMemoryMT, and there is one (unsafe!) change to the API:

+ 4 - 8
src/client.rs

@@ -1,4 +1,3 @@
-use rand::rngs::ThreadRng;
 use rand::RngCore;
 
 use std::collections::VecDeque;
@@ -13,7 +12,6 @@ use rayon::prelude::*;
 
 use subtle::Choice;
 
-use curve25519_dalek::ristretto::RistrettoPoint;
 use curve25519_dalek::scalar::Scalar;
 
 use crate::dbentry_decrypt;
@@ -53,8 +51,6 @@ struct PreProcSingleState {
 }
 
 pub struct Client {
-    r: usize,
-    thread_handle: JoinHandle<()>,
     incoming_cmd: SyncSender<Command>,
     outgoing_resp: Receiver<Response>,
 }
@@ -63,7 +59,7 @@ impl Client {
     pub fn new(r: usize) -> (Self, Vec<u8>) {
         let (incoming_cmd, incoming_cmd_recv) = sync_channel(0);
         let (outgoing_resp_send, outgoing_resp) = sync_channel(0);
-        let thread_handle = spawn(move || {
+        spawn(move || {
             let spiral_params = params::get_spiral_params(r);
             let mut clientrng = rand::thread_rng();
             let mut rng = rand::thread_rng();
@@ -161,7 +157,9 @@ impl Client {
                             .send(Response::QueryDone(decdbentry))
                             .unwrap();
                     }
-                    _ => panic!("Received something unexpected in client loop"),
+                    // When adding new messages, the following line is
+                    // useful during development
+                    // _ => panic!("Received something unexpected in client loop"),
                 }
             }
         });
@@ -172,8 +170,6 @@ impl Client {
 
         (
             Client {
-                r,
-                thread_handle,
                 incoming_cmd,
                 outgoing_resp,
             },

+ 0 - 8
src/lib.rs

@@ -1,7 +1,3 @@
-// We really want points to be capital letters and scalars to be
-// lowercase letters
-#![allow(non_snake_case)]
-
 mod aligned_memory_mt;
 pub mod client;
 mod ot;
@@ -12,9 +8,7 @@ mod spiral_mt;
 use aes::cipher::{BlockEncrypt, KeyInit};
 use aes::Aes128Enc;
 use aes::Block;
-use std::env;
 use std::mem;
-use std::time::Instant;
 
 use serde::{Deserialize, Serialize};
 
@@ -25,9 +19,7 @@ use rayon::ThreadPoolBuilder;
 
 use serde_with::serde_as;
 
-use spiral_rs::client::*;
 use spiral_rs::params::*;
-use spiral_rs::server::*;
 
 use crate::ot::{otkey_init, xor16};
 use crate::spiral_mt::*;

+ 4 - 8
src/server.rs

@@ -7,7 +7,6 @@ use rayon::prelude::*;
 
 use spiral_rs::client::PublicParameters;
 use spiral_rs::client::Query;
-use spiral_rs::params::Params;
 use spiral_rs::server::process_query;
 
 use crate::db_encrypt;
@@ -21,7 +20,6 @@ use crate::PreProcSingleRespMsg;
 use crate::VecData;
 
 enum Command {
-    PubParams(Vec<u8>),
     PreProcMsg(Vec<PreProcSingleMsg>),
     QueryMsg(usize, usize, usize, DbEntry),
 }
@@ -38,8 +36,6 @@ struct PreProcSingleState<'a> {
 }
 
 pub struct Server {
-    r: usize,
-    thread_handle: JoinHandle<()>,
     incoming_cmd: SyncSender<Command>,
     outgoing_resp: Receiver<Response>,
 }
@@ -48,7 +44,7 @@ impl Server {
     pub fn new(r: usize, pub_params: Vec<u8>) -> Self {
         let (incoming_cmd, incoming_cmd_recv) = sync_channel(0);
         let (outgoing_resp_send, outgoing_resp) = sync_channel(0);
-        let thread_handle = spawn(move || {
+        spawn(move || {
             let spiral_params = params::get_spiral_params(r);
             let pub_params = PublicParameters::deserialize(&spiral_params, &pub_params);
             let num_records = 1 << r;
@@ -118,13 +114,13 @@ impl Server {
                         );
                         outgoing_resp_send.send(Response::QueryResp(resp)).unwrap();
                     }
-                    _ => panic!("Received something unexpected"),
+                    // When adding new messages, the following line is
+                    // useful during development
+                    // _ => panic!("Received something unexpected in server loop"),
                 }
             }
         });
         Server {
-            r,
-            thread_handle,
             incoming_cmd,
             outgoing_resp,
         }