Skip to content

Commit

Permalink
recv_buf_from advances the cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
astuyve committed Jan 31, 2025
1 parent cbd22b8 commit f01f1c2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions dogstatsd/src/dogstatsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ impl BufferReader {
// TODO(astuyve) this should be dynamic
// Max buffer size is configurable in Go Agent and the default is 8KB
// https://github.com/DataDog/datadog-agent/blob/85939a62b5580b2a15549f6936f257e61c5aa153/pkg/config/config_template.yaml#L2154-L2158
let mut buf = [0; 8192];
let mut buf = Vec::with_capacity(8 * 1024);
let (amt, src) = socket
.recv_from(&mut buf)
.recv_buf_from(&mut buf)
.await
.expect("didn't receive data");
Ok((buf[..amt].to_owned(), src))
Expand Down Expand Up @@ -84,7 +84,6 @@ impl DogStatsD {
debug!("Received message: {} from {}", msgs, src);
let statsd_metric_strings = msgs.split('\n');
self.insert_metrics(statsd_metric_strings);
drop(buf);
}

fn insert_metrics(&self, msg: Split<char>) {
Expand Down

0 comments on commit f01f1c2

Please sign in to comment.