diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/register.rs | 1 | ||||
-rw-r--r-- | src/sleep.rs | 12 | ||||
-rw-r--r-- | src/sync.rs | 10 |
3 files changed, 10 insertions, 13 deletions
diff --git a/src/register.rs b/src/register.rs index 95695ce..8fc3a6f 100644 --- a/src/register.rs +++ b/src/register.rs @@ -276,7 +276,6 @@ impl SleepDirRegister { let mut rng = OsRng::new()?; rng.fill_bytes(&mut rand_seed); let (secret_key, pub_key) = ed25519::keypair(&rand_seed); - println!("{:?}", directory.join(Path::new(&(prefix.to_owned() + ".key")))); { let mut key_file = OpenOptions::new() .write(true) diff --git a/src/sleep.rs b/src/sleep.rs index 1c10b3e..36bf7a9 100644 --- a/src/sleep.rs +++ b/src/sleep.rs @@ -163,7 +163,7 @@ impl SleepStorage for SleepFile { #[test] fn test_sleep_open() { - let mut sf = SleepFile::open( + let sf = SleepFile::open( Path::new("test-data/sleep/empty/empty.sleep"), false).unwrap(); assert_eq!(sf.len().unwrap(), 0); @@ -171,7 +171,7 @@ fn test_sleep_open() { assert_eq!(sf.get_algorithm(), None); assert_eq!(sf.get_entry_size(), 1); - let mut sf = SleepFile::open( + let sf = SleepFile::open( Path::new("test-data/dat/simple/.dat/metadata.tree"), false).unwrap(); // Calculated from 'dat log' @@ -187,17 +187,17 @@ fn test_sleep_create() { use tempdir::TempDir; let tmp_dir = TempDir::new("geniza-test").unwrap(); - let mut sf = SleepFile::create( + SleepFile::create( &tmp_dir.path().join("empty2.sleep"), 0x050257FF, 1, - None); + None).unwrap(); // TODO: binary diff against 'test-data/sleep/empty/empty.sleep' - let mut sf = SleepFile::create( + SleepFile::create( &tmp_dir.path().join("simple_metadata.sleep"), 0x05025702, 40, - Some("BLAKE2b".into())); + Some("BLAKE2b".into())).unwrap(); } diff --git a/src/sync.rs b/src/sync.rs index d092422..efa045a 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -232,7 +232,7 @@ impl DatConnection { dc.tcp.set_nodelay(true)?; // Faster handshake // send register let mut register_msg = Feed::new(); - register_msg.set_discoveryKey(dk.to_vec()); + register_msg.set_discoveryKey(dc.discovery_key.to_vec()); register_msg.set_nonce((tx_nonce[0..24]).to_vec()); dc.send_register(®ister_msg)?; @@ -246,8 +246,8 @@ impl DatConnection { // send handshake let mut handshake_msg = Handshake::new(); - handshake_msg.set_live(live); - handshake_msg.set_id(local_id.to_vec()); + handshake_msg.set_live(dc.live); + handshake_msg.set_id(dc.id.to_vec()); dc.send_msg(&DatNetMessage::Handshake(handshake_msg), false)?; // read handshake @@ -408,14 +408,12 @@ impl DatConnection { self.send_msg(&DatNetMessage::Want(wm), false)?; // listen for Have - let length; loop { let (was_content, msg) = self.recv_msg()?; if was_content { continue; } - if let DatNetMessage::Have(have) = msg { - length = have.get_length(); + if let DatNetMessage::Have(_) = msg { break; } else { info!("Expected Have message, got: {:?}", &msg); |