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

Fix bug leading links to be closed just after establishment with multiple peers #1661

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions zenoh/src/net/runtime/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const RCV_BUF_SIZE: usize = u16::MAX as usize;
const SCOUT_INITIAL_PERIOD: Duration = Duration::from_millis(1_000);
const SCOUT_MAX_PERIOD: Duration = Duration::from_millis(8_000);
const SCOUT_PERIOD_INCREASE_FACTOR: u32 = 2;
const CONNECTION_TIMEOUT: Duration = Duration::from_millis(10_000);

pub enum Loop {
Continue,
Expand Down Expand Up @@ -350,7 +351,7 @@ impl Runtime {
if retry_config.timeout().is_zero() || self.get_global_connect_timeout().is_zero() {
// try to connect and exit immediately without retry
if self
.peer_connector(endpoint, retry_config.timeout())
.peer_connector(endpoint, CONNECTION_TIMEOUT)
.await
.is_ok()
{
Expand Down Expand Up @@ -379,7 +380,7 @@ impl Runtime {
);
if retry_config.timeout().is_zero() || self.get_global_connect_timeout().is_zero() {
// try to connect and exit immediately without retry
if let Err(e) = self.peer_connector(endpoint, retry_config.timeout()).await {
if let Err(e) = self.peer_connector(endpoint, CONNECTION_TIMEOUT).await {
if retry_config.exit_on_failure {
return Err(e);
}
Expand Down Expand Up @@ -795,7 +796,7 @@ impl Runtime {
tracing::trace!("Trying to connect to configured peer {}", peer);
let endpoint = peer.clone();
tokio::select! {
res = tokio::time::timeout(retry_config.timeout(), self.manager().open_transport_unicast(endpoint)) => {
res = tokio::time::timeout(CONNECTION_TIMEOUT, self.manager().open_transport_unicast(endpoint)) => {
match res {
Ok(Ok(transport)) => {
tracing::debug!("Successfully connected to configured peer {}", peer);
Expand Down Expand Up @@ -977,7 +978,6 @@ impl Runtime {
};

let endpoint = locator.to_owned().into();
let retry_config = self.get_connect_retry_config(&endpoint);
let priorities = locator
.metadata()
.get(Metadata::PRIORITIES)
Expand All @@ -998,7 +998,7 @@ impl Runtime {
{
if is_multicast {
match tokio::time::timeout(
retry_config.timeout(),
CONNECTION_TIMEOUT,
manager.open_transport_multicast(endpoint),
)
.await
Expand All @@ -1014,7 +1014,7 @@ impl Runtime {
}
} else {
match tokio::time::timeout(
retry_config.timeout(),
CONNECTION_TIMEOUT,
manager.open_transport_unicast(endpoint),
)
.await
Expand Down
Loading