Skip to content

Commit

Permalink
fix: multiplex panic
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWhiteWu committed Sep 1, 2023
1 parent cdc99ae commit 2de1365
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion volo-thrift/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "volo-thrift"
version = "0.7.1"
version = "0.7.2"
edition.workspace = true
homepage.workspace = true
repository.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions volo-thrift/src/codec/default/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl<E: ZeroCopyEncoder, W: AsyncWrite + Unpin + Send + Sync + 'static> Encoder
cx.stats_mut().set_write_size(real_size);

let write_result = (|| async {
self.linked_bytes.reset();
// then we reserve the size of the message in the linked bytes
self.linked_bytes.reserve(malloc_size);
// after that, we encode the message into the linked bytes
Expand All @@ -160,8 +161,6 @@ impl<E: ZeroCopyEncoder, W: AsyncWrite + Unpin + Send + Sync + 'static> Encoder
// put write end here so we can also record the time of encode error
cx.stats_mut().record_write_end_at();

// finally, don't forget to reset the linked bytes
self.linked_bytes.reset();
match write_result {
Ok(()) => Ok(()),
Err(mut e) => {
Expand Down

0 comments on commit 2de1365

Please sign in to comment.