1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 09:42:40 +01:00

flush io on complete

This commit is contained in:
Nikolay Kim 2018-08-08 09:12:32 -07:00
parent 992f7a11b3
commit 8eb9eb4247
2 changed files with 7 additions and 6 deletions

View File

@ -337,9 +337,10 @@ impl<T: AsyncWrite, H: 'static> Writer for H1Writer<T, H> {
} }
} }
if shutdown { if shutdown {
self.stream.poll_flush()?;
self.stream.shutdown() self.stream.shutdown()
} else { } else {
Ok(Async::Ready(())) self.stream.poll_flush()
} }
} }
} }

View File

@ -210,7 +210,7 @@ impl Ws2 {
ctx.drain() ctx.drain()
.and_then(|_, act, ctx| { .and_then(|_, act, ctx| {
act.count += 1; act.count += 1;
if act.count != 1_000 { if act.count != 10_000 {
act.send(ctx); act.send(ctx);
} }
actix::fut::ok(()) actix::fut::ok(())
@ -248,7 +248,7 @@ fn test_server_send_text() {
}); });
let (mut reader, _writer) = srv.ws().unwrap(); let (mut reader, _writer) = srv.ws().unwrap();
for _ in 0..1_000 { for _ in 0..10_000 {
let (item, r) = srv.execute(reader.into_future()).unwrap(); let (item, r) = srv.execute(reader.into_future()).unwrap();
reader = r; reader = r;
assert_eq!(item, data); assert_eq!(item, data);
@ -272,7 +272,7 @@ fn test_server_send_bin() {
}); });
let (mut reader, _writer) = srv.ws().unwrap(); let (mut reader, _writer) = srv.ws().unwrap();
for _ in 0..1_000 { for _ in 0..10_000 {
let (item, r) = srv.execute(reader.into_future()).unwrap(); let (item, r) = srv.execute(reader.into_future()).unwrap();
reader = r; reader = r;
assert_eq!(item, data); assert_eq!(item, data);
@ -308,7 +308,7 @@ fn test_ws_server_ssl() {
let (mut reader, _writer) = srv.ws().unwrap(); let (mut reader, _writer) = srv.ws().unwrap();
let data = Some(ws::Message::Text("0".repeat(65_536))); let data = Some(ws::Message::Text("0".repeat(65_536)));
for _ in 0..1_000 { for _ in 0..10_000 {
let (item, r) = srv.execute(reader.into_future()).unwrap(); let (item, r) = srv.execute(reader.into_future()).unwrap();
reader = r; reader = r;
assert_eq!(item, data); assert_eq!(item, data);
@ -347,7 +347,7 @@ fn test_ws_server_rust_tls() {
let (mut reader, _writer) = srv.ws().unwrap(); let (mut reader, _writer) = srv.ws().unwrap();
let data = Some(ws::Message::Text("0".repeat(65_536))); let data = Some(ws::Message::Text("0".repeat(65_536)));
for _ in 0..1_000 { for _ in 0..10_000 {
let (item, r) = srv.execute(reader.into_future()).unwrap(); let (item, r) = srv.execute(reader.into_future()).unwrap();
reader = r; reader = r;
assert_eq!(item, data); assert_eq!(item, data);