Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: redis large payload support (#147)
- bugfix: wait for writable event in Established state before adding to ready queue - bugfix: in edge-case buffer may revert to default 4KB size - bugfix: requeue connection from front when there is no work to maintain order - feature: add redis RESP serialization, required when size >64KB, make default for redis
- Loading branch information
Showing
19 changed files
with
1,008 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#![no_main] | ||
#[macro_use] | ||
extern crate libfuzzer_sys; | ||
#[macro_use] | ||
extern crate log; | ||
extern crate bytes; | ||
extern crate byteorder; | ||
extern crate crc; | ||
extern crate getopts; | ||
extern crate mio; | ||
extern crate mpmc; | ||
extern crate pad; | ||
extern crate time; | ||
extern crate rand; | ||
extern crate ratelimit; | ||
extern crate slab; | ||
extern crate tic; | ||
extern crate toml; | ||
|
||
use std::str; | ||
|
||
#[path = "../../src/cfgtypes/mod.rs"] | ||
mod cfgtypes; | ||
|
||
#[path = "../../src/codec/mod.rs"] | ||
mod codec; | ||
|
||
use cfgtypes::*; | ||
use codec::redis_inline::RedisParse; | ||
|
||
//ProtocolParseFactory | ||
fuzz_target!(|data: &[u8]| { | ||
let parser = RedisParse; | ||
let _ = parser.parse(data); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// rpc-perf - RPC Performance Testing | ||
// Copyright 2017 Twitter, Inc | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use bytes::{ByteBuf, MutByteBuf}; | ||
|
||
#[derive(Debug)] | ||
pub struct Buffer { | ||
rx_bytes: usize, | ||
tx_bytes: usize, | ||
pub rx: Option<MutByteBuf>, | ||
pub tx: Option<MutByteBuf>, | ||
} | ||
|
||
impl Buffer { | ||
pub fn new(rx: usize, tx: usize) -> Buffer { | ||
Buffer { | ||
rx_bytes: rx, | ||
tx_bytes: tx, | ||
rx: Some(ByteBuf::mut_with_capacity(rx)), | ||
tx: Some(ByteBuf::mut_with_capacity(tx)), | ||
} | ||
} | ||
|
||
pub fn clear(&mut self) { | ||
let mut rx = self.rx.take().unwrap_or_else( | ||
|| ByteBuf::mut_with_capacity(self.rx_bytes), | ||
); | ||
rx.clear(); | ||
self.rx = Some(rx); | ||
|
||
let mut tx = self.tx.take().unwrap_or_else( | ||
|| ByteBuf::mut_with_capacity(self.tx_bytes), | ||
); | ||
tx.clear(); | ||
self.tx = Some(tx); | ||
} | ||
} |
Oops, something went wrong.