1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 08:45:10 +02:00

Use .advance() intead of .split_to()

This commit is contained in:
Nikolay Kim
2019-12-19 09:56:14 +06:00
parent 1732ae8c79
commit 8c54054844
4 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@ use actix_codec::{AsyncRead, AsyncWrite, Decoder, Encoder, Framed, FramedParts};
use actix_rt::time::{delay_until, Delay, Instant};
use actix_service::Service;
use bitflags::bitflags;
use bytes::BytesMut;
use bytes::{Buf, BytesMut};
use log::{error, trace};
use crate::body::{Body, BodySize, MessageBody, ResponseBody};
@ -312,7 +312,7 @@ where
}
Poll::Pending => {
if written > 0 {
let _ = self.write_buf.split_to(written);
self.write_buf.advance(written);
}
return Ok(true);
}
@ -322,7 +322,7 @@ where
if written == self.write_buf.len() {
unsafe { self.write_buf.set_len(0) }
} else {
let _ = self.write_buf.split_to(written);
self.write_buf.advance(written);
}
Ok(false)
}