This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add test retries and gc msg valid check
- Loading branch information
Showing
13 changed files
with
107 additions
and
105 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,2 @@ | ||
use graphcast_sdk::graphcast_agent::{ | ||
message_typing::GraphcastMessage, waku_handling::WakuHandlingError, | ||
}; | ||
use poi::PublicPoiMessage; | ||
use std::{ | ||
any::Any, | ||
sync::{mpsc, Mutex as SyncMutex}, | ||
}; | ||
use tracing::{error, trace}; | ||
use upgrade::VersionUpgradeMessage; | ||
|
||
pub mod poi; | ||
pub mod upgrade; | ||
|
||
#[derive(Debug, Clone, serde_derive::Deserialize, serde_derive::Serialize)] | ||
pub enum MessageType { | ||
PublicPoi(GraphcastMessage<poi::PublicPoiMessage>), | ||
VersionUpgrade(GraphcastMessage<upgrade::VersionUpgradeMessage>), | ||
} | ||
|
||
pub fn typed_handler(sender: SyncMutex<mpsc::Sender<MessageType>>, msg: &dyn Any) { | ||
if let Some(Ok(ppoi_message)) = | ||
msg.downcast_ref::<Result<GraphcastMessage<PublicPoiMessage>, WakuHandlingError>>() | ||
{ | ||
trace!( | ||
ppoi_message = tracing::field::debug(&ppoi_message), | ||
"Received Graphcast validated message" | ||
); | ||
|
||
// let id = ppoi_message.identifier.clone(); | ||
// VALIDATED_MESSAGES.with_label_values(&[&id]).inc(); | ||
|
||
match sender | ||
.lock() | ||
.unwrap() | ||
.send(MessageType::PublicPoi(ppoi_message.clone())) | ||
{ | ||
Ok(_) => trace!("Sent received message to radio operator"), | ||
Err(e) => error!("Could not send message to channel: {:#?}", e), | ||
} | ||
} else if let Some(Ok(upgrade_message)) = | ||
msg.downcast_ref::<Result<GraphcastMessage<VersionUpgradeMessage>, WakuHandlingError>>() | ||
{ | ||
trace!( | ||
upgrade_message = tracing::field::debug(&upgrade_message), | ||
"Received Graphcast validated message" | ||
); | ||
|
||
// let id = upgrade_message.identifier.clone(); | ||
// VALIDATED_MESSAGES.with_label_values(&[&id]).inc(); | ||
|
||
match sender | ||
.lock() | ||
.unwrap() | ||
.send(MessageType::VersionUpgrade(upgrade_message.clone())) | ||
{ | ||
Ok(_) => trace!("Sent upgrade message to radio operator"), | ||
Err(e) => error!("Could not send message to channel: {:#?}", e), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters