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"
|
||||
edition = "2018"
|
||||
description = "Kademlia protocol for libp2p"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/libp2p/rust-libp2p"
|
||||
|
@ -159,8 +159,11 @@ where
|
||||
|
||||
#[inline]
|
||||
fn upgrade_inbound(self, incoming: C, _: Self::Info) -> Self::Future {
|
||||
let mut codec = codec::UviBytes::default();
|
||||
codec.set_max_len(4096);
|
||||
|
||||
future::ok(
|
||||
Framed::new(incoming, codec::UviBytes::default())
|
||||
Framed::new(incoming, codec)
|
||||
.from_err::<IoError>()
|
||||
.with::<_, fn(_) -> _, _>(|response| -> Result<_, IoError> {
|
||||
let proto_struct = resp_msg_to_proto(response);
|
||||
@ -185,8 +188,11 @@ where
|
||||
|
||||
#[inline]
|
||||
fn upgrade_outbound(self, incoming: C, _: Self::Info) -> Self::Future {
|
||||
let mut codec = codec::UviBytes::default();
|
||||
codec.set_max_len(4096);
|
||||
|
||||
future::ok(
|
||||
Framed::new(incoming, codec::UviBytes::default())
|
||||
Framed::new(incoming, codec)
|
||||
.from_err::<IoError>()
|
||||
.with::<_, fn(_) -> _, _>(|request| -> Result<_, IoError> {
|
||||
let proto_struct = req_msg_to_proto(request);
|
||||
|
Reference in New Issue
Block a user