Skip to content

Commit

Permalink
gate pending message error message behind feature flag
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Schoolderman <[email protected]>
  • Loading branch information
tweedegolf-marc authored and marlonbaeten committed Jul 30, 2024
1 parent 6cea2bf commit 549190c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name = "demo-server"
path = "src/server.rs"

[dependencies]
tsp = { path = "../tsp" }
tsp = { path = "../tsp", features = ["async"] }
axum = { workspace = true}
base64ct = { workspace = true }
clap = { workspace = true}
Expand Down
4 changes: 4 additions & 0 deletions tsp/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ pub enum Error {
MissingVid(String),
#[error("Error: unresolved vid {0}")]
UnverifiedVid(String),
#[cfg(feature = "async")]
#[error("Error: no relation with sender {0}")]
UnverifiedSource(String, Option<Vec<u8>>),
#[cfg(not(feature = "async"))]
#[error("Error: no relation with sender {0}")]
UnverifiedSource(String),
#[error("Error: unresolved next hop {0}")]
UnresolvedNextHop(String),
#[error("Error: no relation with next hop {0}")]
Expand Down
4 changes: 4 additions & 0 deletions tsp/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,10 @@ impl Store {
let sender = String::from_utf8(sender.to_vec())?;

let Ok(sender_vid) = self.get_verified_vid(&sender) else {
#[cfg(feature = "async")]
return Err(Error::UnverifiedSource(sender, None));
#[cfg(not(feature = "async"))]
return Err(Error::UnverifiedSource(sender));
};

let (nonconfidential_data, payload) =
Expand All @@ -565,6 +568,7 @@ impl Store {
if self.get_verified_vid(inner_vid).is_err() {
return Err(Error::UnverifiedSource(
inner_vid.to_owned(),
#[cfg(feature = "async")]
Some(inner.to_vec()),
));
}
Expand Down

0 comments on commit 549190c

Please sign in to comment.