@@ -123,7 +123,7 @@ fn resume_identity(conn: &mut SqliteConnection, public_ip: Ipv4Addr) -> Result<N
123
123
let id_in_base64 =
124
124
prev_id. expect ( "if the public ip of last session matches this session, id should have been set" ) ;
125
125
let id = base64_dec ( id_in_base64) ;
126
- Ok ( NodeId :: from_bytes_unchecked ( & * id) )
126
+ Ok ( NodeId :: from_bytes ( & * id) )
127
127
} else {
128
128
// IP changed, generate new ID
129
129
let id = random_idv4 ( & public_ip, rand:: rng ( ) . random :: < u8 > ( ) ) ;
@@ -365,38 +365,4 @@ mod tests {
365
365
drop ( dht_eventloop) ;
366
366
Ok ( ( ) )
367
367
}
368
-
369
- #[ tokio:: test( flavor = "multi_thread" ) ]
370
- async fn find_peers ( ) -> color_eyre:: Result < ( ) > {
371
- todo ! ( "Proabaly just stick it inside of the json_rpc server instead of doing it here" ) ;
372
- // TEST_INIT.call_once(set_up_tracing);
373
- //
374
- // let external_ip = public_ip::addr_v4().await.unwrap();
375
- //
376
- // let dht = DhtV4::with_stable_id(
377
- // SocketAddrV4::from_str("0.0.0.0:44444").unwrap(),
378
- // external_ip,
379
- // vec![
380
- // // dht.tansmissionbt.com
381
- // "87.98.162.88:6881".parse().unwrap(),
382
- // // router.utorrent.com
383
- // "67.215.246.10:6881".parse().unwrap(),
384
- // // router.bittorrent.com, ironically that this almost never responds
385
- // "82.221.103.244:6881".parse().unwrap(),
386
- // // dht.aelitis.com
387
- // "174.129.43.152:6881".parse().unwrap(),
388
- // ],
389
- // )
390
- // .await?;
391
- //
392
- // // XXX: get_peers design is problematic, impl has been replaced with todo!(), see the
393
- // // comment on the function itself for more info.
394
- // //
395
- // let info_hash = InfoHash::from_hex_str("233b78ca585fe0a8c9e8eb4bda03f52e8b6f554b");
396
- //
397
- // let handle = dht.handle();
398
- // let peers = handle.get_peers(info_hash).await?;
399
- // info!("peers {peers:?}");
400
- // Ok(())
401
- }
402
368
}
0 commit comments