1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-20 08:31:09 +00: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 {
self.stream.poll_flush()?;
self.stream.shutdown()
} else {
Ok(Async::Ready(()))
self.stream.poll_flush()
}
}
}

View file

@ -210,7 +210,7 @@ impl Ws2 {
ctx.drain()
.and_then(|_, act, ctx| {
act.count += 1;
if act.count != 1_000 {
if act.count != 10_000 {
act.send(ctx);
}
actix::fut::ok(())
@ -248,7 +248,7 @@ fn test_server_send_text() {
});
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();
reader = r;
assert_eq!(item, data);
@ -272,7 +272,7 @@ fn test_server_send_bin() {
});
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();
reader = r;
assert_eq!(item, data);
@ -308,7 +308,7 @@ fn test_ws_server_ssl() {
let (mut reader, _writer) = srv.ws().unwrap();
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();
reader = r;
assert_eq!(item, data);
@ -347,7 +347,7 @@ fn test_ws_server_rust_tls() {
let (mut reader, _writer) = srv.ws().unwrap();
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();
reader = r;
assert_eq!(item, data);