mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-03 01:25:37 +00:00
perf: simplify method signatures and reduce clone across multiple files (#1663)
This commit is contained in:
@@ -192,7 +192,7 @@ impl PeerConn {
|
||||
self.is_hole_punched
|
||||
}
|
||||
|
||||
async fn wait_handshake(&mut self, need_retry: &mut bool) -> Result<HandshakeRequest, Error> {
|
||||
async fn wait_handshake(&self, need_retry: &mut bool) -> Result<HandshakeRequest, Error> {
|
||||
*need_retry = false;
|
||||
|
||||
let mut locked = self.recv.lock().await;
|
||||
@@ -241,7 +241,7 @@ impl PeerConn {
|
||||
Ok(rsp)
|
||||
}
|
||||
|
||||
async fn wait_handshake_loop(&mut self) -> Result<HandshakeRequest, Error> {
|
||||
async fn wait_handshake_loop(&self) -> Result<HandshakeRequest, Error> {
|
||||
timeout(Duration::from_secs(5), async move {
|
||||
loop {
|
||||
let mut need_retry = true;
|
||||
@@ -260,7 +260,7 @@ impl PeerConn {
|
||||
.await?
|
||||
}
|
||||
|
||||
async fn send_handshake(&mut self, send_secret_digest: bool) -> Result<(), Error> {
|
||||
async fn send_handshake(&self, send_secret_digest: bool) -> Result<(), Error> {
|
||||
let network = self.global_ctx.get_network_identity();
|
||||
let mut req = HandshakeRequest {
|
||||
magic: MAGIC,
|
||||
@@ -384,8 +384,7 @@ impl PeerConn {
|
||||
traffic_rx_bytes: stats_mgr.get_counter(MetricName::TrafficBytesRx, label_set.clone()),
|
||||
traffic_tx_packets: stats_mgr
|
||||
.get_counter(MetricName::TrafficPacketsTx, label_set.clone()),
|
||||
traffic_rx_packets: stats_mgr
|
||||
.get_counter(MetricName::TrafficPacketsRx, label_set.clone()),
|
||||
traffic_rx_packets: stats_mgr.get_counter(MetricName::TrafficPacketsRx, label_set),
|
||||
};
|
||||
self.counters.store(Some(Arc::new(counters)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user