Skip to content

Commit

Permalink
Merge branch 'main' into fix-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Apr 14, 2024
2 parents 8986f1c + fe626a8 commit 6c4269b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ jobs:
- name: List contents of the reports directory
run: ls -a reports
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
directory: reports
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ thiserror = "1"
tracing = "0.1"
viewit = "0.1.5"

memberlist-core = { version = "0.2.0-alpha.1", path = "core", default-features = false }
memberlist-net = { version = "0.2.0-alpha.1", path = "transports/net", default-features = false }
memberlist-types = { version = "0.2.0-alpha.1", path = "types", default-features = false }
memberlist-quic = { version = "0.2.0-alpha.1", path = "transports/quic", default-features = false }
memberlist-core = { version = "0.2", path = "core", default-features = false }
memberlist-net = { version = "0.2", path = "transports/net", default-features = false }
memberlist-types = { version = "0.2", path = "types", default-features = false }
memberlist-quic = { version = "0.2", path = "transports/quic", default-features = false }
2 changes: 1 addition & 1 deletion core/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ where
if let Err(e) = self.transport.shutdown().await {
tracing::error!(err=%e, "memberlist: failed to shutdown transport");
return Err(e);
}
}

Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/network/packet/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ where
let this = self.clone();
let packet_rx = this.inner.transport.packet();
<T::Runtime as RuntimeLite>::spawn(async move {
loop {
'outer: loop {
futures::select! {
_ = shutdown_rx.recv().fuse() => {
break;
break 'outer;
}
packet = packet_rx.recv().fuse() => {
match packet {
Expand All @@ -59,7 +59,7 @@ where
}
// If we got an error, which means on the other side the transport has been closed,
// so we need to return and shutdown the packet listener
break;
break 'outer;
},
}
}
Expand Down
5 changes: 1 addition & 4 deletions core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,7 @@ macro_rules! bail_trigger {
if this.inner.shutdown_tx.is_closed() {
break 'outer;
}
let shutdown = this.$fn(&stop_rx).await;
if shutdown {
break 'outer;
}
this.$fn(&stop_rx).await;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion transports/net/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "memberlist-net"
version.workspace = true
version = "0.2.2"
edition.workspace = true
license.workspace = true
repository.workspace = true
Expand Down
1 change: 0 additions & 1 deletion transports/net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@ where

let mut handles = core::mem::take(&mut *self.handles.borrow_mut());
while handles.next().await.is_some() {}

Ok(())
}
}
Expand Down
22 changes: 16 additions & 6 deletions transports/net/src/packet_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,29 @@ where
};
let keys = encryptor.keys().await;
if encrypted_message_size <= offload_size {
return Self::decrypt(algo, keys, packet_label.as_bytes(), &mut encrypted_message).and_then(
|_| Self::read_from_packet_without_compression_and_encryption(encrypted_message),
);
return Self::decrypt(
algo,
keys,
packet_label.as_bytes(),
&mut encrypted_message,
)
.and_then(|_| Self::read_from_packet_without_compression_and_encryption(encrypted_message));
}

let (tx, rx) = futures::channel::oneshot::channel();

rayon::spawn(move || {
if tx
.send(
Self::decrypt(algo, keys, packet_label.as_bytes(), &mut encrypted_message).and_then(
|_| Self::read_from_packet_without_compression_and_encryption(encrypted_message),
),
Self::decrypt(
algo,
keys,
packet_label.as_bytes(),
&mut encrypted_message,
)
.and_then(|_| {
Self::read_from_packet_without_compression_and_encryption(encrypted_message)
}),
)
.is_err()
{
Expand Down

0 comments on commit 6c4269b

Please sign in to comment.