mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 17:21:34 +00:00
Limit Kademlia messages to 4kiB (#920)
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-kad"
|
name = "libp2p-kad"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Kademlia protocol for libp2p"
|
description = "Kademlia protocol for libp2p"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
|
@ -159,8 +159,11 @@ where
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn upgrade_inbound(self, incoming: C, _: Self::Info) -> Self::Future {
|
fn upgrade_inbound(self, incoming: C, _: Self::Info) -> Self::Future {
|
||||||
|
let mut codec = codec::UviBytes::default();
|
||||||
|
codec.set_max_len(4096);
|
||||||
|
|
||||||
future::ok(
|
future::ok(
|
||||||
Framed::new(incoming, codec::UviBytes::default())
|
Framed::new(incoming, codec)
|
||||||
.from_err::<IoError>()
|
.from_err::<IoError>()
|
||||||
.with::<_, fn(_) -> _, _>(|response| -> Result<_, IoError> {
|
.with::<_, fn(_) -> _, _>(|response| -> Result<_, IoError> {
|
||||||
let proto_struct = resp_msg_to_proto(response);
|
let proto_struct = resp_msg_to_proto(response);
|
||||||
@ -185,8 +188,11 @@ where
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn upgrade_outbound(self, incoming: C, _: Self::Info) -> Self::Future {
|
fn upgrade_outbound(self, incoming: C, _: Self::Info) -> Self::Future {
|
||||||
|
let mut codec = codec::UviBytes::default();
|
||||||
|
codec.set_max_len(4096);
|
||||||
|
|
||||||
future::ok(
|
future::ok(
|
||||||
Framed::new(incoming, codec::UviBytes::default())
|
Framed::new(incoming, codec)
|
||||||
.from_err::<IoError>()
|
.from_err::<IoError>()
|
||||||
.with::<_, fn(_) -> _, _>(|request| -> Result<_, IoError> {
|
.with::<_, fn(_) -> _, _>(|request| -> Result<_, IoError> {
|
||||||
let proto_struct = req_msg_to_proto(request);
|
let proto_struct = req_msg_to_proto(request);
|
||||||
|
Reference in New Issue
Block a user