Skip to content

Commit 56e71be

Browse files
committed
feat(onion_client): move dht_pk_tx to the state
1 parent 2d62003 commit 56e71be

File tree

2 files changed

+43
-52
lines changed

2 files changed

+43
-52
lines changed

examples/onion_client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ fn main() {
7676

7777
let dht_server = Server::new(tx.clone(), dht_pk, dht_sk.clone());
7878
let tcp_connections = Connections::new(dht_pk, dht_sk, tcp_incoming_tx);
79-
let onion_client = OnionClient::new(dht_server, tcp_connections, dht_pk_tx, real_sk, real_pk);
79+
let onion_client = OnionClient::new(dht_server, tcp_connections, real_sk, real_pk);
80+
81+
onion_client.set_dht_pk_sink(dht_pk_tx);
8082

8183
for &(pk, saddr) in &BOOTSTRAP_NODES {
8284
// get PK bytes of the bootstrap node

src/toxcore/onion/client/mod.rs

Lines changed: 40 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ struct OnionClientState {
288288
announce_requests: RequestQueue<AnnounceRequestData>,
289289
/// List of friends we are looking for.
290290
friends: HashMap<PublicKey, OnionFriend>,
291+
/// Sink to send DHT `PublicKey` when it gets known. The first key is a long
292+
/// term key, the second key is a DHT key.
293+
dht_pk_tx: Option<DhtPkTx>,
291294
}
292295

293296
impl OnionClientState {
@@ -297,6 +300,7 @@ impl OnionClientState {
297300
announce_list: Kbucket::new(MAX_ONION_ANNOUNCE_NODES),
298301
announce_requests: RequestQueue::new(ANNOUNCE_TIMEOUT),
299302
friends: HashMap::new(),
303+
dht_pk_tx: None,
300304
}
301305
}
302306
}
@@ -309,9 +313,6 @@ pub struct OnionClient {
309313
dht: DhtServer,
310314
/// TCP connections instance.
311315
tcp_connections: TcpConnections,
312-
/// Sink to send DHT `PublicKey` when it gets known. The first key is a long
313-
/// term key, the second key is a DHT key.
314-
dht_pk_tx: DhtPkTx,
315316
/// Our long term `SecretKey`.
316317
real_sk: SecretKey,
317318
/// Our long term `PublicKey`.
@@ -330,15 +331,13 @@ impl OnionClient {
330331
pub fn new(
331332
dht: DhtServer,
332333
tcp_connections: TcpConnections,
333-
dht_pk_tx: DhtPkTx,
334334
real_sk: SecretKey,
335335
real_pk: PublicKey
336336
) -> Self {
337337
let (data_pk, data_sk) = gen_keypair();
338338
OnionClient {
339339
dht,
340340
tcp_connections,
341-
dht_pk_tx,
342341
real_sk,
343342
real_pk,
344343
data_sk,
@@ -347,6 +346,11 @@ impl OnionClient {
347346
}
348347
}
349348

349+
/// Set sink to send DHT `PublicKey` when it gets known.
350+
pub fn set_dht_pk_sink(&self, dht_pk_tx: DhtPkTx) {
351+
self.state.lock().dht_pk_tx = Some(dht_pk_tx);
352+
}
353+
350354
/// Check if a node was pinged recently.
351355
fn is_pinged_recently(&self, pk: PublicKey, search_pk: PublicKey, request_queue: &RequestQueue<AnnounceRequestData>) -> bool {
352356
let check_pks = |data: &AnnounceRequestData| -> bool {
@@ -495,7 +499,11 @@ impl OnionClient {
495499
friend.dht_pk = Some(dht_pk_announce.dht_pk);
496500
friend.last_seen = Some(clock_now());
497501

498-
let dht_pk_future = send_to(&self.dht_pk_tx, (friend_pk, dht_pk_announce.dht_pk));
502+
let dht_pk_future = if let Some(ref dht_pk_tx) = state.dht_pk_tx {
503+
Either::A(send_to(dht_pk_tx, (friend_pk, dht_pk_announce.dht_pk)))
504+
} else {
505+
Either::B(future::ok(()))
506+
};
499507

500508
let futures = dht_pk_announce.nodes.into_iter().map(|node| match node.ip_port.protocol {
501509
ProtocolType::UDP => {
@@ -919,6 +927,7 @@ mod tests {
919927
announce_list: Kbucket::new(8),
920928
announce_requests: RequestQueue::new(Duration::from_secs(42)),
921929
friends: HashMap::new(),
930+
dht_pk_tx: None,
922931
};
923932

924933
let _onion_client_state_c = onion_client_state.clone();
@@ -930,10 +939,9 @@ mod tests {
930939
let (real_pk, real_sk) = gen_keypair();
931940
let (udp_tx, _udp_rx) = mpsc::channel(1);
932941
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
933-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
934942
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
935943
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
936-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk, real_pk);
944+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk, real_pk);
937945

938946
let _onion_client_c = onion_client.clone();
939947
}
@@ -1051,10 +1059,9 @@ mod tests {
10511059
let (real_pk, real_sk) = gen_keypair();
10521060
let (udp_tx, _udp_rx) = mpsc::channel(1);
10531061
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1054-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
10551062
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
10561063
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1057-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk, real_pk);
1064+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk, real_pk);
10581065

10591066
let node = PackedNode::new("127.0.0.1:12345".parse().unwrap(), &gen_keypair().0);
10601067
onion_client.add_path_node(node);
@@ -1069,10 +1076,9 @@ mod tests {
10691076
let (real_pk, real_sk) = gen_keypair();
10701077
let (udp_tx, _udp_rx) = mpsc::channel(1);
10711078
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1072-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
10731079
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
10741080
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1075-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk, real_pk);
1081+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk, real_pk);
10761082

10771083
let (friend_pk, _friend_sk) = gen_keypair();
10781084
onion_client.add_friend(friend_pk);
@@ -1087,10 +1093,9 @@ mod tests {
10871093
let (real_pk, real_sk) = gen_keypair();
10881094
let (udp_tx, udp_rx) = mpsc::channel(1);
10891095
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1090-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
10911096
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
10921097
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1093-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk, real_pk);
1098+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk, real_pk);
10941099

10951100
let mut state = onion_client.state.lock();
10961101

@@ -1162,10 +1167,9 @@ mod tests {
11621167
let (real_pk, real_sk) = gen_keypair();
11631168
let (udp_tx, _udp_rx) = mpsc::channel(1);
11641169
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1165-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
11661170
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
11671171
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1168-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk, real_pk);
1172+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk, real_pk);
11691173

11701174
let mut state = onion_client.state.lock();
11711175

@@ -1216,10 +1220,9 @@ mod tests {
12161220
let (real_pk, real_sk) = gen_keypair();
12171221
let (udp_tx, udp_rx) = mpsc::channel(1);
12181222
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1219-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
12201223
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
12211224
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1222-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1225+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
12231226

12241227
let mut state = onion_client.state.lock();
12251228

@@ -1277,10 +1280,9 @@ mod tests {
12771280
let (real_pk, real_sk) = gen_keypair();
12781281
let (udp_tx, udp_rx) = mpsc::channel(1);
12791282
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1280-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
12811283
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
12821284
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1283-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1285+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
12841286

12851287
let mut state = onion_client.state.lock();
12861288

@@ -1357,10 +1359,9 @@ mod tests {
13571359
let (real_pk, real_sk) = gen_keypair();
13581360
let (udp_tx, _udp_rx) = mpsc::channel(1);
13591361
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1360-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
13611362
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
13621363
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1363-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1364+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
13641365

13651366
let mut state = onion_client.state.lock();
13661367

@@ -1406,10 +1407,9 @@ mod tests {
14061407
let (real_pk, real_sk) = gen_keypair();
14071408
let (udp_tx, _udp_rx) = mpsc::channel(1);
14081409
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1409-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
14101410
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
14111411
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1412-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1412+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
14131413

14141414
let mut state = onion_client.state.lock();
14151415

@@ -1446,10 +1446,9 @@ mod tests {
14461446
let (real_pk, real_sk) = gen_keypair();
14471447
let (udp_tx, _udp_rx) = mpsc::channel(1);
14481448
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1449-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
14501449
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
14511450
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1452-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1451+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
14531452

14541453
let mut state = onion_client.state.lock();
14551454

@@ -1486,10 +1485,9 @@ mod tests {
14861485
let (real_pk, real_sk) = gen_keypair();
14871486
let (udp_tx, udp_rx) = mpsc::channel(1);
14881487
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1489-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
14901488
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
14911489
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1492-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1490+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
14931491

14941492
let mut state = onion_client.state.lock();
14951493

@@ -1557,7 +1555,9 @@ mod tests {
15571555
let (dht_pk_tx, dht_pk_rx) = mpsc::unbounded();
15581556
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
15591557
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1560-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1558+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
1559+
1560+
onion_client.set_dht_pk_sink(dht_pk_tx);
15611561

15621562
let (friend_dht_pk, _friend_dht_sk) = gen_keypair();
15631563
let (friend_real_pk, friend_real_sk) = gen_keypair();
@@ -1594,10 +1594,9 @@ mod tests {
15941594
let (real_pk, real_sk) = gen_keypair();
15951595
let (udp_tx, _udp_rx) = mpsc::channel(1);
15961596
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1597-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
15981597
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
15991598
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1600-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1599+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
16011600

16021601
let (friend_dht_pk, _friend_dht_sk) = gen_keypair();
16031602
let (friend_real_pk, friend_real_sk) = gen_keypair();
@@ -1621,10 +1620,9 @@ mod tests {
16211620
let (real_pk, real_sk) = gen_keypair();
16221621
let (udp_tx, _udp_rx) = mpsc::channel(1);
16231622
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1624-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
16251623
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
16261624
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1627-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1625+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
16281626

16291627
let (friend_dht_pk, _friend_dht_sk) = gen_keypair();
16301628
let (friend_real_pk, friend_real_sk) = gen_keypair();
@@ -1653,10 +1651,9 @@ mod tests {
16531651
let (real_pk, real_sk) = gen_keypair();
16541652
let (udp_tx, _udp_rx) = mpsc::channel(1);
16551653
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1656-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
16571654
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
16581655
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1659-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1656+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
16601657

16611658
let onion_data_response = OnionDataResponse {
16621659
nonce: gen_nonce(),
@@ -1674,10 +1671,9 @@ mod tests {
16741671
let (real_pk, real_sk) = gen_keypair();
16751672
let (udp_tx, _udp_rx) = mpsc::channel(1);
16761673
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1677-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
16781674
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
16791675
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1680-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1676+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
16811677

16821678
let onion_data_response_payload = OnionDataResponsePayload {
16831679
real_pk: gen_keypair().0,
@@ -1696,10 +1692,9 @@ mod tests {
16961692
let (real_pk, real_sk) = gen_keypair();
16971693
let (udp_tx, udp_rx) = mpsc::channel(MAX_ONION_ANNOUNCE_NODES as usize / 2);
16981694
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1699-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
17001695
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
17011696
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1702-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1697+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
17031698

17041699
let mut state = onion_client.state.lock();
17051700

@@ -1743,10 +1738,9 @@ mod tests {
17431738
let (real_pk, real_sk) = gen_keypair();
17441739
let (udp_tx, udp_rx) = mpsc::channel(MAX_ONION_ANNOUNCE_NODES as usize);
17451740
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1746-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
17471741
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
17481742
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1749-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1743+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
17501744

17511745
let mut state = onion_client.state.lock();
17521746

@@ -1822,10 +1816,9 @@ mod tests {
18221816
let (real_pk, real_sk) = gen_keypair();
18231817
let (udp_tx, udp_rx) = mpsc::channel(MAX_ONION_ANNOUNCE_NODES as usize / 2);
18241818
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1825-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
18261819
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
18271820
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1828-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1821+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
18291822

18301823
let mut state = onion_client.state.lock();
18311824

@@ -1872,10 +1865,9 @@ mod tests {
18721865
let (real_pk, real_sk) = gen_keypair();
18731866
let (udp_tx, udp_rx) = mpsc::channel(MAX_ONION_FRIEND_NODES as usize);
18741867
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1875-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
18761868
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
18771869
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1878-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1870+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
18791871

18801872
let mut state = onion_client.state.lock();
18811873

@@ -1954,10 +1946,9 @@ mod tests {
19541946
let (real_pk, real_sk) = gen_keypair();
19551947
let (udp_tx, udp_rx) = mpsc::channel(MAX_ONION_FRIEND_NODES as usize);
19561948
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
1957-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
19581949
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
19591950
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
1960-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
1951+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
19611952

19621953
let mut state = onion_client.state.lock();
19631954

@@ -2040,10 +2031,9 @@ mod tests {
20402031
let (real_pk, real_sk) = gen_keypair();
20412032
let (udp_tx, udp_rx) = mpsc::channel(MAX_ONION_FRIEND_NODES as usize);
20422033
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
2043-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
20442034
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
20452035
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
2046-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk.clone(), real_pk);
2036+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk.clone(), real_pk);
20472037

20482038
let mut state = onion_client.state.lock();
20492039

@@ -2091,10 +2081,9 @@ mod tests {
20912081
let (real_pk, real_sk) = gen_keypair();
20922082
let (udp_tx, udp_rx) = mpsc::channel(1);
20932083
let (tcp_incoming_tx, _tcp_incoming_rx) = mpsc::unbounded();
2094-
let (dht_pk_tx, _dht_pk_rx) = mpsc::unbounded();
20952084
let dht = DhtServer::new(udp_tx, dht_pk, dht_sk.clone());
20962085
let tcp_connections = TcpConnections::new(dht_pk, dht_sk, tcp_incoming_tx);
2097-
let onion_client = OnionClient::new(dht, tcp_connections, dht_pk_tx, real_sk, real_pk);
2086+
let onion_client = OnionClient::new(dht, tcp_connections, real_sk, real_pk);
20982087

20992088
let (node_pk, node_sk) = gen_keypair();
21002089
let node = PackedNode::new("127.0.0.1:12345".parse().unwrap(), &node_pk);

0 commit comments

Comments
 (0)