node: Handle error in handshake call

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
Alexis Sellier 2022-10-10 11:36:42 +02:00
parent 832c6ad53f
commit d652df7c30
No known key found for this signature in database
1 changed files with 10 additions and 2 deletions

View File

@ -738,7 +738,7 @@ where
// Process a peer announcement. // Process a peer announcement.
(SessionState::Negotiated { id, git, .. }, Message::Announcement(ann)) => { (SessionState::Negotiated { id, git, .. }, Message::Announcement(ann)) => {
let git = git.clone(); let git = git.clone();
let id = id.clone(); let id = *id;
// Returning true here means that the message should be relayed. // Returning true here means that the message should be relayed.
if self.handle_announcement(&id, &git, &ann)? { if self.handle_announcement(&id, &git, &ann)? {
@ -1030,7 +1030,15 @@ mod gossip {
config: &Config, config: &Config,
) -> [Message; 4] { ) -> [Message; 4] {
let git = config.git_url.clone(); let git = config.git_url.clone();
let inventory = storage.inventory().unwrap(); let inventory = match storage.inventory() {
Ok(i) => i,
Err(e) => {
error!("Error getting local inventory for handshake: {}", e);
// Other than crashing the node completely, there's nothing we can do
// here besides returning an empty inventory and logging an error.
vec![]
}
};
[ [
Message::init(*signer.public_key(), config.listen.clone(), git), Message::init(*signer.public_key(), config.listen.clone(), git),