-
Notifications
You must be signed in to change notification settings - Fork 2k
chore(statsd sink): refactor statsd sink to stream-based style
#16199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
db9f4ca
e5280d9
a22763e
0ab950b
bacf1ff
a17e839
8609e9f
a08bc84
b32e933
6037898
f28379f
cd9fe58
8c1dd18
36f5627
577efa9
f67a09e
f0f531b
667ce41
2144849
78e633b
fe9a495
392c4d7
fce04a2
332dff2
7664aa7
35cde29
292b171
1373f1e
74d9bff
f6d7292
be7c5ef
d35bcf4
43b3c3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ Enot | |
| Evercoss | ||
| Explay | ||
| FAQs | ||
| FQDNs | ||
| Fabro | ||
| Figma | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //! Networking-related helper functions. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a curiosity not an issue - I noticed this is directly in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this could/should actually live in Ironically, |
||
| use std::{io, time::Duration}; | ||
|
|
||
| use socket2::{SockRef, TcpKeepalive}; | ||
| use tokio::net::TcpStream; | ||
|
|
||
| /// Sets the receive buffer size for a socket. | ||
| /// | ||
| /// This is the equivalent of setting the `SO_RCVBUF` socket setting directly. | ||
| /// | ||
| /// # Errors | ||
| /// | ||
| /// If there is an error setting the receive buffer size on the given socket, or if the value given | ||
| /// as the socket is not a valid socket, an error variant will be returned explaining the underlying | ||
| /// I/O error. | ||
| pub fn set_receive_buffer_size<'s, S>(socket: &'s S, size: usize) -> io::Result<()> | ||
| where | ||
| SockRef<'s>: From<&'s S>, | ||
| { | ||
| SockRef::from(socket).set_recv_buffer_size(size) | ||
| } | ||
|
|
||
| /// Sets the send buffer size for a socket. | ||
| /// | ||
| /// This is the equivalent of setting the `SO_SNDBUF` socket setting directly. | ||
| /// | ||
| /// # Errors | ||
| /// | ||
| /// If there is an error setting the send buffer size on the given socket, or if the value given | ||
| /// as the socket is not a valid socket, an error variant will be returned explaining the underlying | ||
| /// I/O error. | ||
| pub fn set_send_buffer_size<'s, S>(socket: &'s S, size: usize) -> io::Result<()> | ||
| where | ||
| SockRef<'s>: From<&'s S>, | ||
| { | ||
| SockRef::from(socket).set_send_buffer_size(size) | ||
| } | ||
|
|
||
| /// Sets the TCP keepalive behavior on a socket. | ||
| /// | ||
| /// This is the equivalent of setting the `SO_KEEPALIVE` and `TCP_KEEPALIVE` socket settings | ||
| /// directly. | ||
| /// | ||
| /// # Errors | ||
| /// | ||
| /// If there is an error with either enabling keepalive probes or setting the TCP keepalive idle | ||
| /// timeout on the given socket, an error variant will be returned explaining the underlying I/O | ||
| /// error. | ||
| pub fn set_keepalive(socket: &TcpStream, ttl: Duration) -> io::Result<()> { | ||
| SockRef::from(socket).set_tcp_keepalive(&TcpKeepalive::new().with_time(ttl)) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.