mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
set socket linger to 0 on timeout
This commit is contained in:
parent
1bac65de4c
commit
e4686f6c8d
@ -1,6 +1,6 @@
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::net::SocketAddr;
|
use std::net::{Shutdown, SocketAddr};
|
||||||
use std::time::Instant;
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use futures::{Async, Future, Poll};
|
use futures::{Async, Future, Poll};
|
||||||
@ -239,6 +239,12 @@ where
|
|||||||
if self.tasks.is_empty() {
|
if self.tasks.is_empty() {
|
||||||
// if we get timer during shutdown, just drop connection
|
// if we get timer during shutdown, just drop connection
|
||||||
if self.flags.contains(Flags::SHUTDOWN) {
|
if self.flags.contains(Flags::SHUTDOWN) {
|
||||||
|
let io = self.stream.get_mut();
|
||||||
|
let _ = IoStream::set_linger(
|
||||||
|
io,
|
||||||
|
Some(Duration::from_secs(0)),
|
||||||
|
);
|
||||||
|
let _ = IoStream::shutdown(io, Shutdown::Both);
|
||||||
return Err(HttpDispatchError::ShutdownTimeout);
|
return Err(HttpDispatchError::ShutdownTimeout);
|
||||||
} else {
|
} else {
|
||||||
trace!("Keep-alive timeout, close connection");
|
trace!("Keep-alive timeout, close connection");
|
||||||
|
Loading…
Reference in New Issue
Block a user