dataframe struc definition
This commit is contained in:
parent
145cbb9243
commit
8f12a03e46
5 changed files with 78 additions and 7 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -37,9 +37,10 @@ async fn handle_connection(stream: TcpStream) -> tokio::io::Result<()> {
|
|||
async fn handle_http_connection(
|
||||
mut stream: TcpStream,
|
||||
) -> tokio::io::Result<Option<websoket_connection::WebsocketConnection>> {
|
||||
let mut timeout = 500;
|
||||
loop {
|
||||
let req = match time::timeout(
|
||||
Duration::from_millis(500),
|
||||
Duration::from_millis(timeout),
|
||||
request::Request::from_bufreader(&mut stream),
|
||||
)
|
||||
.await
|
||||
|
|
@ -65,9 +66,9 @@ async fn handle_http_connection(
|
|||
}
|
||||
}
|
||||
["websocket"] => {
|
||||
return Ok(Some(WebsocketConnection::initialize_connection(
|
||||
req, stream,
|
||||
)?));
|
||||
return Ok(Some(
|
||||
WebsocketConnection::initialize_connection(req, stream).await?,
|
||||
));
|
||||
}
|
||||
[] => Response::new()
|
||||
.with_code(ResponseCode::PermanentRedirect)
|
||||
|
|
@ -83,6 +84,8 @@ async fn handle_http_connection(
|
|||
|
||||
stream.flush().await?;
|
||||
|
||||
timeout = 5000;
|
||||
|
||||
if req.headers.contains(&request::RequestHeader::Connection(
|
||||
request::Connection::Close,
|
||||
)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue