fix out of boudns
This commit is contained in:
@@ -185,7 +185,7 @@ pub enum NetworkCommand {
|
||||
SendDatum(MerkleNode, [u8; 32], String),
|
||||
SendNoDatum(Vec<u8>, String),
|
||||
SendRootReply(Vec<u8>, String),
|
||||
InitDownload([u8; 32], String),
|
||||
InitDownload([u8; 32], String, String),
|
||||
// ...
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ pub enum NetworkEvent {
|
||||
ServerHandshakeFailed(String),
|
||||
DatumRequest([u8; 32], String),
|
||||
RootRequest(String),
|
||||
InitDownload([u8; 32], String),
|
||||
InitDownload([u8; 32], String, String),
|
||||
// ...
|
||||
}
|
||||
|
||||
@@ -246,11 +246,14 @@ pub fn start_p2p_executor(
|
||||
// Check for commands from the GUI
|
||||
if let Ok(cmd) = cmd_rx.try_recv() {
|
||||
match cmd {
|
||||
NetworkCommand::InitDownload(hash, ip) => {
|
||||
NetworkCommand::InitDownload(hash, ip, name) => {
|
||||
if let Some(sd) = shared_data.as_ref() {
|
||||
if let Some(res) = sd.handshake_peers.get_peer_info_username(ip) {
|
||||
let _ = event_tx
|
||||
.send(NetworkEvent::InitDownload(hash, res.ip.to_string()));
|
||||
let _ = event_tx.send(NetworkEvent::InitDownload(
|
||||
hash,
|
||||
res.ip.to_string(),
|
||||
name.to_string(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user