aquatic_http: use const LISTENER_TOKEN for clarity

This commit is contained in:
Joakim Frostegård 2020-08-09 00:44:39 +02:00
parent 0a23b62bd5
commit 2893fffd20
2 changed files with 5 additions and 2 deletions

View file

@ -17,6 +17,9 @@ use aquatic_http_protocol::request::Request;
use aquatic_http_protocol::response::{Response, ResponsePeer};
pub const LISTENER_TOKEN: Token = Token(0);
pub trait Ip: Copy + Eq + ::std::hash::Hash {}
impl Ip for Ipv4Addr {}

View file

@ -92,7 +92,7 @@ pub fn run_poll_loop(
for event in events.iter(){
let token = event.token();
if token.0 == 0 {
if token == LISTENER_TOKEN {
accept_new_streams(
&config,
&mut listener,
@ -148,7 +148,7 @@ fn accept_new_streams(
Ok((mut stream, _)) => {
poll_token_counter.0 = poll_token_counter.0.wrapping_add(1);
if poll_token_counter.0 == 0 {
if *poll_token_counter == LISTENER_TOKEN {
poll_token_counter.0 = 1;
}