mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +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::net::SocketAddr;
|
||||
use std::time::Instant;
|
||||
use std::net::{Shutdown, SocketAddr};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures::{Async, Future, Poll};
|
||||
@ -239,6 +239,12 @@ where
|
||||
if self.tasks.is_empty() {
|
||||
// if we get timer during shutdown, just drop connection
|
||||
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);
|
||||
} else {
|
||||
trace!("Keep-alive timeout, close connection");
|
||||
|
Loading…
Reference in New Issue
Block a user