@@ -89,15 +89,15 @@ where
8989 }
9090 }
9191
92- this. state . stats . increment_rx ( size) ;
92+ this. state . stats . specific . increment_rx ( size) ;
9393 let _ = this. to_socket . try_send ( request) ;
9494 }
9595 Some ( Err ( e) ) => {
9696 error ! ( err = ?e, "Error receiving message from peer {:?}" , peer) ;
9797 }
9898 None => {
9999 warn ! ( "Peer {:?} disconnected" , peer) ;
100- this. state . stats . decrement_active_clients ( ) ;
100+ this. state . stats . specific . decrement_active_clients ( ) ;
101101 }
102102 }
103103
@@ -125,7 +125,7 @@ where
125125 }
126126 Err ( e) => {
127127 error ! ( err = ?e, "Error authenticating client" ) ;
128- this. state . stats . decrement_active_clients ( ) ;
128+ this. state . stats . specific . decrement_active_clients ( ) ;
129129 }
130130 }
131131
@@ -137,15 +137,15 @@ where
137137 Ok ( io) => {
138138 if let Err ( e) = this. on_incoming ( io) {
139139 error ! ( err = ?e, "Error accepting incoming connection" ) ;
140- this. state . stats . decrement_active_clients ( ) ;
140+ this. state . stats . specific . decrement_active_clients ( ) ;
141141 }
142142 }
143143 Err ( e) => {
144144 error ! ( err = ?e, "Error accepting incoming connection" ) ;
145145
146146 // Active clients have already been incremented in the initial call to
147147 // `poll_accept`, so we need to decrement them here.
148- this. state . stats . decrement_active_clients ( ) ;
148+ this. state . stats . specific . decrement_active_clients ( ) ;
149149 }
150150 }
151151
@@ -156,7 +156,7 @@ where
156156 // incoming connection tasks.
157157 if let Poll :: Ready ( accept) = Pin :: new ( & mut this. transport ) . poll_accept ( cx) {
158158 if let Some ( max) = this. options . max_clients {
159- if this. state . stats . active_clients ( ) >= max {
159+ if this. state . stats . specific . active_clients ( ) >= max {
160160 warn ! (
161161 "Max connections reached ({}), rejecting new incoming connection" ,
162162 max
@@ -168,7 +168,7 @@ where
168168
169169 // Increment the active clients counter. If the authentication fails, this counter
170170 // will be decremented.
171- this. state . stats . increment_active_clients ( ) ;
171+ this. state . stats . specific . increment_active_clients ( ) ;
172172
173173 this. conn_tasks . push ( accept) ;
174174
@@ -271,14 +271,14 @@ impl<T: AsyncRead + AsyncWrite + Unpin, A: Address + Unpin> Stream for PeerState
271271 let msg_len = msg. size ( ) ;
272272 match this. conn . start_send_unpin ( msg) {
273273 Ok ( _) => {
274- this. state . stats . increment_tx ( msg_len) ;
274+ this. state . stats . specific . increment_tx ( msg_len) ;
275275 this. should_flush = true ;
276276
277277 // We might be able to send more queued messages
278278 continue ;
279279 }
280280 Err ( e) => {
281- this. state . stats . increment_failed_requests ( ) ;
281+ this. state . stats . specific . increment_failed_requests ( ) ;
282282 error ! ( err = ?e, "Failed to send message to socket" ) ;
283283 // End this stream as we can't send any more messages
284284 return Poll :: Ready ( None ) ;
0 commit comments