Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Jan 8, 2025
1 parent 9a491cf commit 0dbbdb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
28 changes: 6 additions & 22 deletions iroh-relay/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,30 +1178,14 @@ mod tests {

// set up client a
let resolver = crate::dns::default_resolver().clone();
let (client_a, mut client_a_receiver) =
ClientBuilder::new(relay_url.clone()).build(a_secret_key, resolver);
let connect_client = client_a.clone();

// give the relay server some time to accept connections
if let Err(err) = tokio::time::timeout(Duration::from_secs(10), async move {
loop {
match connect_client.connect().await {
Ok(_) => break,
Err(err) => {
warn!("client unable to connect to relay server: {err:#}");
tokio::time::sleep(Duration::from_millis(100)).await;
}
}
}
})
.await
{
panic!("timeout connecting to relay server: {err:#}");
}
let mut client_a = ClientBuilder::new(relay_url.clone(), a_secret_key, resolver)
.connect()
.await
.unwrap();

// wait for a moment, until the connection is shutdown
// the next message should be the rejection of the connection
tokio::time::timeout(Duration::from_millis(500), async move {
match client_a_receiver.recv().await.unwrap().unwrap() {
match client_a.next().await.unwrap().unwrap() {
ReceivedMessage::Health { problem } => {
assert_eq!(problem, Some("not authenticated".to_string()));
}
Expand Down
1 change: 0 additions & 1 deletion iroh-relay/src/server/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use tokio_util::{codec::Framed, sync::CancellationToken, task::AbortOnDropHandle
use tracing::{debug, debug_span, error, info, info_span, trace, warn, Instrument};

use super::{clients::Clients, AccessConfig};

use crate::{
defaults::{timeouts::SERVER_WRITE_TIMEOUT, DEFAULT_KEY_CACHE_CAPACITY},
http::{Protocol, LEGACY_RELAY_PATH, RELAY_PATH, SUPPORTED_WEBSOCKET_VERSION},
Expand Down

0 comments on commit 0dbbdb5

Please sign in to comment.