Skip to content

Commit b6eb2bf

Browse files
deps: bump asynchronous-codec from 0.6.2 to 0.7.0
Pull-Request: #4636.
1 parent cddc306 commit b6eb2bf

File tree

25 files changed

+69
-95
lines changed

25 files changed

+69
-95
lines changed

Cargo.lock

Lines changed: 26 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ resolver = "2"
7070
rust-version = "1.73.0"
7171

7272
[workspace.dependencies]
73+
asynchronous-codec = { version = "0.7.0" }
7374
futures-bounded = { version = "0.2.1", path = "misc/futures-bounded" }
7475
libp2p = { version = "0.53.0", path = "libp2p" }
7576
libp2p-allow-block-list = { version = "0.3.0", path = "misc/allow-block-list" }
@@ -119,6 +120,7 @@ prometheus-client = "0.22.0"
119120
quick-protobuf-codec = { version = "0.2.0", path = "misc/quick-protobuf-codec" }
120121
quickcheck = { package = "quickcheck-ext", path = "misc/quickcheck-ext" }
121122
rw-stream-sink = { version = "0.4.0", path = "misc/rw-stream-sink" }
123+
unsigned-varint = { version = "0.8.0" }
122124

123125
[patch.crates-io]
124126

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ serde = { version = "1", optional = true, features = ["derive"] }
3030
smallvec = "1.11.2"
3131
thiserror = "1.0"
3232
tracing = "0.1.37"
33-
unsigned-varint = "0.7"
33+
unsigned-varint = { workspace = true }
3434
void = "1"
3535

3636
[dev-dependencies]

misc/multistream-select/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ futures = "0.3"
1616
tracing = "0.1.37"
1717
pin-project = "1.1.3"
1818
smallvec = "1.11.2"
19-
unsigned-varint = "0.7"
19+
unsigned-varint = { workspace = true }
2020

2121
[dev-dependencies]
2222
async-std = { version = "1.6.2", features = ["attributes"] }

misc/quick-protobuf-codec/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ keywords = ["networking"]
1111
categories = ["asynchronous"]
1212

1313
[dependencies]
14-
asynchronous-codec = { version = "0.6" }
14+
asynchronous-codec = { workspace = true }
1515
bytes = { version = "1" }
1616
thiserror = "1.0"
17-
unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] }
17+
unsigned-varint = { workspace = true, features = ["asynchronous_codec"] }
1818
quick-protobuf = "0.8"
1919

2020
# Passing arguments to the docsrs builder in order to properly document cfg's.

misc/quick-protobuf-codec/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ impl<In, Out> Codec<In, Out> {
3131
}
3232

3333
impl<In: MessageWrite, Out> Encoder for Codec<In, Out> {
34-
type Item = In;
34+
type Item<'a> = In;
3535
type Error = Error;
3636

37-
fn encode(&mut self, item: Self::Item, dst: &mut BytesMut) -> Result<(), Self::Error> {
37+
fn encode(&mut self, item: Self::Item<'_>, dst: &mut BytesMut) -> Result<(), Self::Error> {
3838
let mut encoded_msg = Vec::new();
3939
let mut writer = Writer::new(&mut encoded_msg);
4040
item.write_message(&mut writer)

misc/webrtc-utils/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = "0.1.0"
1111
publish = true
1212

1313
[dependencies]
14-
asynchronous-codec = "0.6"
14+
asynchronous-codec = { workspace = true }
1515
bytes = "1"
1616
futures = "0.3"
1717
hex = "0.4"
@@ -29,7 +29,6 @@ tracing = "0.1.37"
2929

3030
[dev-dependencies]
3131
hex-literal = "0.4"
32-
unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] }
3332

3433
[lints]
3534
workspace = true

misc/webrtc-utils/src/stream.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,9 @@ where
260260
#[cfg(test)]
261261
mod tests {
262262
use super::*;
263+
use crate::stream::framed_dc::codec;
263264
use asynchronous_codec::Encoder;
264265
use bytes::BytesMut;
265-
use quick_protobuf::{MessageWrite, Writer};
266-
use unsigned_varint::codec::UviBytes;
267266

268267
#[test]
269268
fn max_data_len() {
@@ -275,21 +274,13 @@ mod tests {
275274
message: Some(message.to_vec()),
276275
};
277276

278-
let mut encoded_msg = Vec::new();
279-
let mut writer = Writer::new(&mut encoded_msg);
280-
protobuf
281-
.write_message(&mut writer)
282-
.expect("Encoding to succeed");
283-
assert_eq!(encoded_msg.len(), message.len() + PROTO_OVERHEAD);
277+
let mut codec = codec();
284278

285-
let mut uvi = UviBytes::default();
286279
let mut dst = BytesMut::new();
287-
uvi.encode(encoded_msg.as_slice(), &mut dst).unwrap();
280+
codec.encode(protobuf, &mut dst).unwrap();
288281

289282
// Ensure the varint prefixed and protobuf encoded largest message is no longer than the
290283
// maximum limit specified in the libp2p WebRTC specification.
291284
assert_eq!(dst.len(), MAX_MSG_LEN);
292-
293-
assert_eq!(dst.len() - encoded_msg.len(), VARINT_LEN);
294285
}
295286
}

misc/webrtc-utils/src/stream/framed_dc.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ pub(crate) fn new<T>(inner: T) -> FramedDc<T>
2929
where
3030
T: AsyncRead + AsyncWrite,
3131
{
32-
let mut framed = Framed::new(
33-
inner,
34-
quick_protobuf_codec::Codec::new(MAX_MSG_LEN - VARINT_LEN),
35-
);
32+
let mut framed = Framed::new(inner, codec());
3633
// If not set, `Framed` buffers up to 131kB of data before sending, which leads to "outbound
3734
// packet larger than maximum message size" error in webrtc-rs.
3835
framed.set_send_high_water_mark(MAX_DATA_LEN);
3936
framed
4037
}
38+
39+
pub(crate) fn codec() -> quick_protobuf_codec::Codec<Message, Message> {
40+
quick_protobuf_codec::Codec::new(MAX_MSG_LEN - VARINT_LEN)
41+
}

muxers/mplex/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ categories = ["network-programming", "asynchronous"]
1313
[dependencies]
1414
bytes = "1"
1515
futures = "0.3.29"
16-
asynchronous-codec = "0.6"
16+
asynchronous-codec = { workspace = true }
1717
libp2p-core = { workspace = true }
1818
libp2p-identity = { workspace = true }
1919
nohash-hasher = "0.2"
2020
parking_lot = "0.12"
2121
rand = "0.8"
2222
smallvec = "1.11.2"
2323
tracing = "0.1.37"
24-
unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] }
24+
unsigned-varint = { workspace = true, features = ["asynchronous_codec"] }
2525

2626
[dev-dependencies]
2727
async-std = { version = "1.7.0", features = ["attributes"] }

0 commit comments

Comments
 (0)