Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude two swarm event from panic in file-sharing example #2580

Merged
merged 5 commits into from Mar 22, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/file-sharing.rs
Expand Up @@ -138,7 +138,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
network_client.respond_file(file_content, channel).await;
}
}
_ => todo!(),
e => todo!("{:?}", e),
}
}
}
Expand Down Expand Up @@ -499,6 +499,9 @@ mod network {
}
}
}
// Exclude these two events from panic to prevent unexpected panic. (Issue #2546)
SwarmEvent::IncomingConnectionError { error, .. } => println!("{}", error),
SwarmEvent::Dialing(peer_id) => println!("{}", peer_id),
mxinden marked this conversation as resolved.
Show resolved Hide resolved
e => panic!("{:?}", e),
}
}
Expand Down Expand Up @@ -631,6 +634,7 @@ mod network {
},
}

#[derive(Debug)]
pub enum Event {
InboundRequest {
request: String,
Expand Down