Reduce packet recv batches (#3894)

* Reduce packet recv batches

* Fix type
This commit is contained in:
Sagar Dhawan 2019-04-18 19:24:37 -07:00 committed by GitHub
parent b8ee952135
commit 475a74d37f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -19,6 +19,8 @@ pub type PacketSender = Sender<Packets>;
pub type BlobSender = Sender<SharedBlobs>;
pub type BlobReceiver = Receiver<SharedBlobs>;
const RECV_BATCH_MAX: usize = 60_000;
fn recv_loop(sock: &UdpSocket, exit: Arc<AtomicBool>, channel: &PacketSender) -> Result<()> {
loop {
let mut msgs = Packets::default();
@ -73,7 +75,7 @@ pub fn recv_batch(recvr: &PacketReceiver) -> Result<(Vec<Packets>, usize, u64)>
len += more.packets.len();
batch.push(more);
if len > 100_000 {
if len > RECV_BATCH_MAX {
break;
}
}