aquatic_http network code: improve comments

This commit is contained in:
Joakim Frostegård 2020-07-02 21:22:27 +02:00
parent 81983b98a2
commit b43eeb4d65

View file

@ -59,9 +59,8 @@ fn accept_new_streams(
} }
/// On the stream given by poll_token, get TLS up and running if requested,
/// On the stream given by poll_token, get TLS (if requested) and tungstenite /// then read requests and pass on through channel.
/// up and running, then read messages and pass on through channel.
pub fn run_handshake_and_read_requests( pub fn run_handshake_and_read_requests(
socket_worker_index: usize, socket_worker_index: usize,
request_channel_sender: &RequestChannelSender, request_channel_sender: &RequestChannelSender,
@ -98,6 +97,7 @@ pub fn run_handshake_and_read_requests(
Err(RequestReadError::NeedMoreData) => { Err(RequestReadError::NeedMoreData) => {
info!("need more data"); info!("need more data");
// Stop reading data (defer to later events)
break; break;
}, },
Err(err) => { Err(err) => {
@ -105,7 +105,9 @@ pub fn run_handshake_and_read_requests(
connections.remove(&poll_token); connections.remove(&poll_token);
break; // Stop reading data. Later events don't matter since
// connection was just removed.
break;
}, },
} }
} else if let Some(connection) = connections.remove(&poll_token){ } else if let Some(connection) = connections.remove(&poll_token){
@ -126,7 +128,7 @@ pub fn run_handshake_and_read_requests(
} }
/// Read messages from channel, send to peers /// Read responses from channel, send to peers
pub fn send_responses( pub fn send_responses(
response_channel_receiver: ::flume::Drain<(ConnectionMeta, Response)>, response_channel_receiver: ::flume::Drain<(ConnectionMeta, Response)>,
connections: &mut ConnectionMap, connections: &mut ConnectionMap,
@ -174,7 +176,6 @@ pub fn remove_inactive_connections(
} }
// will be almost identical to ws version
pub fn run_poll_loop( pub fn run_poll_loop(
config: Config, config: Config,
socket_worker_index: usize, socket_worker_index: usize,