fix #283, build regression because of flow-stat with usize

This commit is contained in:
zonyitoo
2020-08-08 01:48:43 +08:00
parent a198207bcb
commit 36a14836e0
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -176,7 +176,7 @@ async fn flow_report_task(context: SharedContext) -> io::Result<()> {
let tx = flow_stat.tcp().tx() + flow_stat.udp().tx();
let rx = flow_stat.tcp().rx() + flow_stat.udp().rx();
let buf: [u64; 2] = [tx, rx];
let buf: [u64; 2] = [tx as u64, rx as u64];
let buf = unsafe { slice::from_raw_parts(buf.as_ptr() as *const _, 16) };
match time::timeout(timeout, stream.write_all(buf)).await {
+2 -2
View File
@@ -374,7 +374,7 @@ impl AsyncRead for ProxyStream {
{
if self.is_proxied() {
if let Poll::Ready(Ok(n)) = p {
self.context().local_flow_statistic().tcp().incr_rx(n as u64);
self.context().local_flow_statistic().tcp().incr_rx(n);
}
}
}
@@ -392,7 +392,7 @@ impl AsyncWrite for ProxyStream {
{
if self.is_proxied() {
if let Poll::Ready(Ok(n)) = p {
self.context().local_flow_statistic().tcp().incr_tx(n as u64);
self.context().local_flow_statistic().tcp().incr_tx(n);
}
}
}
+2 -2
View File
@@ -346,7 +346,7 @@ impl ProxyAssociation {
#[cfg(feature = "local-flow-stat")]
{
context.local_flow_statistic().udp().incr_tx(send_len as u64);
context.local_flow_statistic().udp().incr_tx(send_len);
}
Ok(())
@@ -482,7 +482,7 @@ impl ProxyAssociation {
#[cfg(feature = "local-flow-stat")]
{
context.local_flow_statistic().udp().incr_rx(recv_n as u64);
context.local_flow_statistic().udp().incr_rx(recv_n);
}
Ok((addr, payload))