1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01: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

@ -1,6 +1,6 @@
# Changes
## [1.0.xx] - 2019-12-xx
## [1.0.1] - 2019-12-xx
### Fixed

View File

@ -5,7 +5,7 @@ use std::mem::MaybeUninit;
use std::task::Poll;
use actix_codec::Decoder;
use bytes::{Bytes, BytesMut};
use bytes::{Buf, Bytes, BytesMut};
use http::header::{HeaderName, HeaderValue};
use http::{header, Method, StatusCode, Uri, Version};
use httparse;
@ -477,7 +477,7 @@ macro_rules! byte (
($rdr:ident) => ({
if $rdr.len() > 0 {
let b = $rdr[0];
let _ = $rdr.split_to(1);
$rdr.advance(1);
b
} else {
return Poll::Pending

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)
}

View File

@ -1,6 +1,6 @@
use std::convert::TryFrom;
use bytes::{BufMut, BytesMut};
use bytes::{Buf, BufMut, BytesMut};
use log::debug;
use rand;
@ -108,7 +108,7 @@ impl Parser {
}
// remove prefix
let _ = src.split_to(idx);
src.advance(idx);
// no need for body
if length == 0 {