Fix gossip messages growing beyond blob size (#5460)

* fixed bloom filter math

* Add split each pull request into multiple pulls with different filters

* Rework CrdsFilter to generate all possible masks to cover the keyspace

* Limit the bloom sizes such that each pull request is no larger than mtu
This commit is contained in:
Sagar Dhawan
2019-08-12 13:51:29 -07:00
committed by GitHub
parent b6151b5200
commit a8eb0409b7
8 changed files with 301 additions and 92 deletions

View File

@@ -335,7 +335,9 @@ pub fn to_blob<T: Serialize>(resp: T, rsp_addr: SocketAddr) -> Result<Blob> {
let mut b = Blob::default();
let v = bincode::serialize(&resp)?;
let len = v.len();
assert!(len <= BLOB_SIZE);
if len > BLOB_SIZE {
return Err(Error::ToBlobError);
}
b.data[..len].copy_from_slice(&v);
b.meta.size = len;
b.meta.set_addr(&rsp_addr);