Skip to content

Commit

Permalink
fix: public cbor/json codec module
Browse files Browse the repository at this point in the history
follow-up to #5792

configuring a request_response behavior with generic codec does not allow for setting request/response size limits.

e.g. the following fails to compile since `request_response::cbor::codec` is private:
```rust
let non_default_codec = request_response::cbor::codec::Codec::<CustomRequest, CustomLargeResponse>::default()
.set_response_size_maximum(large_response_size_max);
let request_response = request_response::Behaviour::with_codec(
non_default_codec,
std::iter::once((
StreamProtocol::new("/request-response/1"),
request_response::ProtocolSupport::Full,
)),
request_response::Config::default(),
);
```

Pull-Request: #5830.
  • Loading branch information
mosure authored Jan 28, 2025
1 parent fee8bf0 commit 3ce976d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
libp2p-quic = { version = "0.12.0", path = "transports/quic" }
libp2p-relay = { version = "0.19.1", path = "protocols/relay" }
libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" }
libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" }
libp2p-server = { version = "0.12.6", path = "misc/server" }
libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" }
libp2p-swarm = { version = "0.46.0", path = "swarm" }
Expand Down
5 changes: 5 additions & 0 deletions protocols/request-response/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.28.1

- fix: public cbor/json codec module
See [PR 5830](https://github.com/libp2p/rust-libp2p/pull/5830).

## 0.28.0

- Deprecate `void` crate.
Expand Down
2 changes: 1 addition & 1 deletion protocols/request-response/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-request-response"
edition = "2021"
rust-version = { workspace = true }
description = "Generic Request/Response Protocols"
version = "0.28.0"
version = "0.28.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
2 changes: 1 addition & 1 deletion protocols/request-response/src/cbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/// ```
pub type Behaviour<Req, Resp> = crate::Behaviour<codec::Codec<Req, Resp>>;

mod codec {
pub mod codec {
use std::{collections::TryReserveError, convert::Infallible, io, marker::PhantomData};

use async_trait::async_trait;
Expand Down
2 changes: 1 addition & 1 deletion protocols/request-response/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/// ```
pub type Behaviour<Req, Resp> = crate::Behaviour<codec::Codec<Req, Resp>>;

mod codec {
pub mod codec {
use std::{io, marker::PhantomData};

use async_trait::async_trait;
Expand Down

0 comments on commit 3ce976d

Please sign in to comment.