Skip to content

Commit

Permalink
Fix misprint.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: cec8d77edaf44c5527af694300118ad28748f5f4
  • Loading branch information
levlam committed Jul 22, 2020
1 parent db628a8 commit 813e2b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tdnet/td/net/HttpReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Result<size_t> HttpReader::read_next(HttpQuery *query) {
gzip_flow_ = GzipByteFlow(Gzip::Mode::Decode);
GzipByteFlow::Options options;
options.write_watermark.low = 0;
options.write_watermark.hight = max_post_size_ + 10;
options.write_watermark.high = max_post_size_ + 10;
gzip_flow_.set_options(options);
//gzip_flow_.set_max_output_size(MAX_CONTENT_SIZE);
*source >> gzip_flow_;
Expand Down Expand Up @@ -177,7 +177,7 @@ Result<size_t> HttpReader::read_next(HttpQuery *query) {
state_ = State::ReadContentToFile;
GzipByteFlow::Options options;
options.write_watermark.low = 4 << 20;
options.write_watermark.hight = 8 << 20;
options.write_watermark.high = 8 << 20;
gzip_flow_.set_options(options);
continue;
}
Expand Down
9 changes: 5 additions & 4 deletions tdutils/td/utils/ByteFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "td/utils/buffer.h"
#include "td/utils/common.h"
#include "td/utils/Status.h"

#include <limits>

namespace td {
Expand Down Expand Up @@ -66,19 +67,19 @@ class ByteFlowBaseCommon : public ByteFlowInterface {
if (read_size < min(need_size_, options_.read_watermark.low)) {
can_read = false;
}
if (read_size >= max(need_size_, options_.read_watermark.hight)) {
if (read_size >= max(need_size_, options_.read_watermark.high)) {
can_read = true;
}

} else {
//Alway can read when input is closed
// always can read when input is closed
can_read = true;
}

// update can_write
{
auto write_size = get_write_size();
if (write_size > options_.write_watermark.hight) {
if (write_size > options_.write_watermark.high) {
can_write = false;
}
if (write_size <= options_.write_watermark.low) {
Expand Down Expand Up @@ -114,7 +115,7 @@ class ByteFlowBaseCommon : public ByteFlowInterface {

struct Watermark {
size_t low{std::numeric_limits<size_t>::max()};
size_t hight{0};
size_t high{0};
};
struct Options {
Watermark write_watermark;
Expand Down

0 comments on commit 813e2b2

Please sign in to comment.