Skip to content

Commit

Permalink
remove some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal authored and FlorentinDUBOIS committed Jul 13, 2022
1 parent af38431 commit 99b1d29
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 68 deletions.
1 change: 0 additions & 1 deletion bin/src/command/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ impl CommandServer {
CommandRequestData::ReloadConfiguration { path }=> {
self.reload_configuration(Some(client_id), request.id, path).await;
},
//r => error!("unknown request: {:?}", r),
}
}

Expand Down
10 changes: 0 additions & 10 deletions lib/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,6 @@ impl Session {
}
}

/*
fn back_socket(&self) -> Option<&TcpStream> {
match *unwrap_msg!(self.protocol.as_ref()) {
State::Http(ref http) => http.back_socket(),
State::WebSocket(ref pipe) => pipe.back_socket(),
State::Expect(_) => None,
}
}
*/

fn back_socket_mut(&mut self) -> Option<&mut TcpStream> {
match *unwrap_msg!(self.protocol.as_mut()) {
State::Http(ref mut http) => http.back_socket_mut(),
Expand Down
24 changes: 0 additions & 24 deletions lib/src/https_openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,6 @@ impl Session {
}
}

/*
fn front_socket(&self) -> Option<&TcpStream> {
match unwrap_msg!(self.protocol.as_ref()) {
&State::Expect(ref expect,_) => Some(expect.front_socket()),
&State::Handshake(ref handshake) => handshake.socket(),
&State::Http(ref http) => Some(http.front_socket()),
&State::Http2(ref http) => Some(http.front_socket()),
&State::WebSocket(ref pipe) => Some(pipe.front_socket()),
}
}
*/

fn front_socket_mut(&mut self) -> Option<&mut TcpStream> {
match *unwrap_msg!(self.protocol.as_mut()) {
State::Expect(ref mut expect,_) => Some(expect.front_socket_mut()),
Expand All @@ -457,18 +445,6 @@ impl Session {
}
}

/*
fn back_socket(&self) -> Option<&TcpStream> {
match unwrap_msg!(self.protocol.as_ref()) {
&State::Expect(_,_) => None,
&State::Handshake(_) => None,
&State::Http(ref http) => http.back_socket(),
&State::Http2(ref http) => http.back_socket(),
&State::WebSocket(ref pipe) => pipe.back_socket(),
}
}
*/

fn back_socket_mut(&mut self) -> Option<&mut TcpStream> {
match *unwrap_msg!(self.protocol.as_mut()) {
State::Expect(_,_) => None,
Expand Down
12 changes: 6 additions & 6 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,13 +750,13 @@ impl fmt::Display for LogDuration {
let ms = self.0.whole_milliseconds();

if ms < 10 {
let us = self.0.whole_microseconds();
if us >= 10 {
return write!(f, "{}μs", us);
}
let us = self.0.whole_microseconds();
if us >= 10 {
return write!(f, "{}μs", us);
}

let ns = self.0.whole_nanoseconds();
return write!(f, "{}ns", ns);
let ns = self.0.whole_nanoseconds();
return write!(f, "{}ns", ns);
}

write!(f, "{}ms", ms)
Expand Down
25 changes: 20 additions & 5 deletions lib/src/protocol/http/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
#![allow(dead_code)]
use super::cookies::{RequestCookie, parse_request_cookies};

use nom::{Err, IResult, Needed, Offset, branch::alt, bytes::{self, complete::{take_while1 as take_while1_complete}, streaming::{is_not, tag, tag_no_case, take, take_while, take_while1}}, character::{
is_alphanumeric, is_space,
streaming::{char, one_of},
complete::digit1 as digit_complete
}, combinator::{complete, map_res, opt, recognize}, error::{Error, ErrorKind}, multi::many0, sequence::{delimited, preceded, terminated, tuple}};
use nom::{
Err, IResult, Needed, Offset,
error::{Error, ErrorKind, ParseError},
branch::alt,
multi::many0,
sequence::{delimited, preceded, terminated, tuple},
combinator::{opt, map_res, complete, recognize},
character::{
is_alphanumeric, is_space,
streaming::{char, one_of},
complete::digit1 as digit_complete
},
bytes::{
self,
streaming::{is_not, tag, tag_no_case, take, take_while, take_while1},
complete::{take_while1 as take_while1_complete}
},
};

use std::{fmt,str};
use std::str::from_utf8;
Expand Down Expand Up @@ -435,9 +448,11 @@ fn end_of_chunk_and_header(i: &[u8]) -> IResult<&[u8], usize> {
preceded(crlf, chunk_header)(i)
}

/*
fn trailer_line(i: &[u8]) -> IResult<&[u8], &[u8]> {
terminated(take_while1(is_header_value_char), crlf)(i)
}
*/

#[derive(PartialEq,Debug,Clone,Copy)]
pub enum Chunk {
Expand Down
1 change: 0 additions & 1 deletion lib/src/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ impl Router {
},
MethodRuleResult::None => {}
},
PathRuleResult::Equals => return Some(app_id.clone()),
PathRuleResult::Prefix(sz) => if sz >= prefix_length {
match method_rule.matches(method) {
// FIXME: the rule order will be important here
Expand Down
21 changes: 0 additions & 21 deletions lib/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,6 @@ impl Session {
}
}

/*
fn request_id(&self) -> Option<&Ulid> {
match self.protocol {
Some(State::Pipe(ref pipe)) => Some(&pipe.request_id),
_ => None,
}
}
*/

fn log_context(&self) -> String {
format!("{} {} {}\t",
self.request_id,
Expand Down Expand Up @@ -290,18 +281,6 @@ impl Session {
}
}

/*
fn back_socket(&self) -> Option<&TcpStream> {
match self.protocol {
Some(State::Pipe(ref pipe)) => pipe.back_socket(),
Some(State::SendProxyProtocol(ref pp)) => pp.back_socket(),
Some(State::RelayProxyProtocol(ref pp)) => pp.back_socket(),
Some(State::ExpectProxyProtocol(_)) => None,
_ => unreachable!(),
}
}
*/

fn back_socket_mut(&mut self) -> Option<&mut TcpStream> {
match self.protocol {
Some(State::Pipe(ref mut pipe)) => pipe.back_socket_mut(),
Expand Down

0 comments on commit 99b1d29

Please sign in to comment.