Skip to content

Commit

Permalink
refactor(lib): resolve unused warnings from server-specific code (#2710)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar authored Nov 30, 2021
1 parent 7435cc3 commit ce82425
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub(super) enum Parse {
#[cfg(feature = "http1")]
VersionH2,
Uri,
#[cfg_attr(not(all(feature = "http1", feature = "server")), allow(unused))]
UriTooLong,
Header(Header),
TooLarge,
Expand Down
1 change: 1 addition & 0 deletions src/proto/h1/conn.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt;
use std::io;
use std::marker::PhantomData;
#[cfg(all(feature = "server", feature = "runtime"))]
use std::time::Duration;

use bytes::{Buf, Bytes};
Expand Down
5 changes: 3 additions & 2 deletions src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fmt;
use std::io::{self, IoSlice};
use std::marker::Unpin;
use std::mem::MaybeUninit;
#[cfg(all(feature = "server", feature = "runtime"))]
use std::future::Future;
#[cfg(all(feature = "server", feature = "runtime"))]
use std::time::Duration;
Expand All @@ -11,7 +12,7 @@ use std::time::Duration;
use tokio::time::Instant;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tracing::{debug, warn, trace};
use tracing::{debug, trace};

use super::{Http1Transaction, ParseContext, ParsedMessage};
use crate::common::buf::BufList;
Expand Down Expand Up @@ -227,7 +228,7 @@ where
if Pin::new( h1_header_read_timeout_fut).poll(cx).is_ready() {
*parse_ctx.h1_header_read_timeout_running = false;

warn!("read header from client timeout");
tracing::warn!("read header from client timeout");
return Poll::Ready(Err(crate::Error::new_header_timeout()))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/proto/h1/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::pin::Pin;
use std::time::Duration;
#[cfg(all(feature = "server", feature = "runtime"))]
use std::{pin::Pin, time::Duration};

use bytes::BytesMut;
use http::{HeaderMap, Method};
Expand Down
1 change: 1 addition & 0 deletions src/proto/h1/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::proto::{BodyLength, MessageHead, RequestHead, RequestLine};

const MAX_HEADERS: usize = 100;
const AVERAGE_HEADER_SIZE: usize = 30; // totally scientific
#[cfg(feature = "server")]
const MAX_URI_LEN: usize = (u16::MAX - 1) as usize;

macro_rules! header_name {
Expand Down

1 comment on commit ce82425

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'end_to_end'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: ce82425 Previous: 7435cc3 Ratio
http2_parallel_x10_req_10kb_100_chunks_adaptive_window 18793366 ns/iter (± 9481088) 8944281 ns/iter (± 8761229) 2.10

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.