Skip to content

Commit

Permalink
Debugging macos CI test fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
manforowicz committed Dec 10, 2024
1 parent 6786a25 commit 31010f3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
# - ubuntu-latest
# - windows-latest
- macos-latest
toolchain:
- stable
- beta
- nightly
# - beta
# - nightly
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 2 additions & 2 deletions gday_contact_exchange_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl std::fmt::Display for FullContact {

/// Writes `msg` to `writer` using [`serde_json`], and flushes.
///
/// Prefixes the message with 2 bytes holding the [`PROTOCOL_VERSION`]
/// Prefixes the message with 1 byte holding the [`PROTOCOL_VERSION`]
/// and 2 bytes holding the length of the following message (all in big-endian).
pub fn write_to(msg: impl Serialize, writer: &mut impl Write) -> Result<(), Error> {
let vec = serde_json::to_vec(&msg)?;
Expand All @@ -300,7 +300,7 @@ pub fn write_to(msg: impl Serialize, writer: &mut impl Write) -> Result<(), Erro

/// Asynchronously writes `msg` to `writer` using [`serde_json`], and flushes.
///
/// Prefixes the message with 2 bytes holding the [`PROTOCOL_VERSION`]
/// Prefixes the message with 1 byte holding the [`PROTOCOL_VERSION`]
/// and 2 bytes holding the length of the following message (all in big-endian).
pub async fn write_to_async(
msg: impl Serialize,
Expand Down
4 changes: 2 additions & 2 deletions gday_file_transfer/src/offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl FileResponseMsg {

/// Writes `msg` to `writer` using [`serde_json`], and flushes.
///
/// Prefixes the message with 2 bytes holding the [`PROTOCOL_VERSION`]
/// Prefixes the message with 1 byte holding the [`PROTOCOL_VERSION`]
/// and 4 bytes holding the length of the following message (all in big-endian).
pub fn write_to(msg: impl Serialize, writer: &mut impl Write) -> Result<(), Error> {
let vec = serde_json::to_vec(&msg)?;
Expand All @@ -181,7 +181,7 @@ pub fn write_to(msg: impl Serialize, writer: &mut impl Write) -> Result<(), Erro

/// Asynchronously writes `msg` to `writer` using [`serde_json`], and flushes.
///
/// Prefixes the message with 2 bytes holding the [`PROTOCOL_VERSION`]
/// Prefixes the message with 1 byte holding the [`PROTOCOL_VERSION`]
/// and 4 bytes holding the length of the following message (all in big-endian).
pub async fn write_to_async(
msg: impl Serialize,
Expand Down
4 changes: 3 additions & 1 deletion gday_server/src/connection_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use gday_contact_exchange_protocol::{read_from_async, write_to_async, ClientMsg,
use log::{error, info, warn};
use std::net::SocketAddr;
use tokio::{
io::{AsyncRead, AsyncWrite},
io::{AsyncRead, AsyncWrite, AsyncWriteExt},
net::TcpStream,
};
use tokio_rustls::TlsAcceptor;
Expand All @@ -27,8 +27,10 @@ pub async fn handle_connection(
}
};
let _ = handle_requests(&mut tls_stream, state, origin).await;
let _ = tls_stream.shutdown().await;
} else {
let _ = handle_requests(&mut tcp_stream, state, origin).await;
let _ = tcp_stream.shutdown().await;
}
}

Expand Down
8 changes: 4 additions & 4 deletions gday_server/tests/test_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ async fn test_request_limit() {
},
&mut stream_v4,
);
assert!(matches!(
result,
Err(gday_contact_exchange_protocol::Error::IO(_))
));
assert!(
matches!(result, Err(gday_contact_exchange_protocol::Error::IO(_))),
"Expected Error::IO, got {result:?}."
);

// ensure other connections are unaffected
write_to(
Expand Down

0 comments on commit 31010f3

Please sign in to comment.