Skip to content

Commit

Permalink
set wbuf to 256k by default, support auto expand & shrink
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelMaker committed Sep 7, 2017
1 parent ff62c4c commit 9ca0508
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/pika_client_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ int PikaClientConn::DealMessage() {
slash::StringToLower(opt);
std::string res = DoCmd(opt);

while ((wbuf_size_ - wbuf_len_ <= res.size())) {
if (!ExpandWbuf()) {
LOG(WARNING) << "wbuf is too large";
memcpy(wbuf_, "-ERR buf is too large\r\n", 23);
wbuf_len_ = 23;
if ((wbuf_size_ - wbuf_len_ < res.size())) {
if (!ExpandWbufTo(wbuf_len_ + res.size())) {
LOG(WARNING) << "ExpandWbufTo " << wbuf_len_ + res.size() << " Failed";
memcpy(wbuf_, "-ERR expand writer buffer failed\r\n", 34);
wbuf_len_ = 34;
set_is_reply(true);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion third/pink

0 comments on commit 9ca0508

Please sign in to comment.