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

chore(node): [#1999] panic on upnp event GatewayNotFound #2003

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sn_networking/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ pub enum NetworkEvent {
#[derive(Debug, Clone)]
pub enum TerminateNodeReason {
HardDiskWriteError,
UpnpGatewayNotFound,
}

// Manually implement Debug as `#[debug(with = "unverified_record_fmt")]` not working as expected.
Expand Down
7 changes: 7 additions & 0 deletions sn_networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

use crate::event::TerminateNodeReason;
use crate::{
cmd::LocalSwarmCmd,
event::NodeEvent,
Expand Down Expand Up @@ -80,6 +81,12 @@ impl SwarmDriver {
}
event_string = "upnp_event";
info!(?upnp_event, "UPnP event");
if let libp2p::upnp::Event::GatewayNotFound = upnp_event {
warn!("UPnP is not enabled/supported on the gateway. Please rerun without the `--upnp` flag");
self.send_event(NetworkEvent::TerminateNode {
reason: TerminateNodeReason::UpnpGatewayNotFound,
});
}
}

SwarmEvent::Behaviour(NodeEvent::RelayServer(event)) => {
Expand Down
Loading