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: ignore empty frames #22

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
32 changes: 19 additions & 13 deletions src/transport/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,28 @@ impl<In: RpcMessage, Out: RpcMessage> ServerChannel<In, Out> {
// This assumes each chunk received corresponds to a single HTTP2 frame.
while let Some(chunk) = stream.next().await {
match chunk {
Ok(chunk) => match bincode::deserialize::<In>(chunk.as_ref()) {
Ok(msg) => {
event!(Level::TRACE, "Server got msg: {} bytes", chunk.len());
match req_tx.send_async(msg).await {
Ok(()) => {}
Err(cause) => {
error!("Flume request channel closed: {}", cause);
break;
Ok(chunk) if !chunk.is_empty() => {
match bincode::deserialize::<In>(chunk.as_ref()) {
Ok(msg) => {
event!(Level::TRACE, "Server got msg: {} bytes", chunk.len());
match req_tx.send_async(msg).await {
Ok(()) => {}
Err(cause) => {
error!("Flume request channel closed: {}", cause);
break;
}
}
}
Err(cause) => {
error!("Failed to deserialise request as bincode: {}", cause);
break;
}
}
Err(cause) => {
error!("Failed to deserialise request as bincode: {}", cause);
break;
}
},
}
Ok(_) => {
// does an empty chunk always signal end of stream?
continue;
}
Err(cause) => {
error!("Failed to read request from networks: {}", cause);
break;
Expand Down