Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions server/src/io/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ use futures::{select, StreamExt};
use futures::{FutureExt, SinkExt};
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use tokio::codec::Framed;
use tokio::net::TcpStream;
use tokio::timer::Timeout;

/// Runs a worker task for the given client.
pub async fn run_worker(
Expand Down Expand Up @@ -75,7 +77,7 @@ async fn _run_worker(

select! {
msg = rx_server_to_worker.next().fuse() => server_message = Some(msg),
packet = framed.next().fuse() => received_packet = Some(packet),
packet = Timeout::new(framed.next(), Duration::from_millis(10000)).fuse() => received_packet = Some(packet),
}

if let Some(msg) = server_message {
Expand All @@ -89,7 +91,7 @@ async fn _run_worker(
}

if let Some(packet_result) = received_packet {
if let Some(packet_result) = packet_result {
if let Some(packet_result) = packet_result? {
match packet_result {
Ok(packet) => {
if let Some(ih) = initial_handler.as_mut() {
Expand Down