SslStream: fix ByteFlow logic

GitOrigin-RevId: 37e5ecd1480e0bb3035ea5ce0f10261cedfd1612
This commit is contained in:
Arseny Smirnov 2020-07-24 18:49:33 +03:00
parent 421ec5fa8f
commit 47d2e8276a
2 changed files with 9 additions and 0 deletions

View File

@ -93,6 +93,10 @@ void HttpConnectionBase::timeout_expired() {
stop();
}
void HttpConnectionBase::loop() {
if (ssl_stream_) {
//ssl_stream_.read_byte_flow().set_need_size(0);
ssl_stream_.write_byte_flow().reset_need_size();
}
sync_with_poll(fd_);
if (can_read_local(fd_)) {
LOG(DEBUG) << "Can read from the connection";

View File

@ -23,6 +23,8 @@ class ByteFlowInterface {
virtual size_t get_need_size() = 0;
virtual size_t get_read_size() = 0;
virtual size_t get_write_size() = 0;
virtual void reset_need_size() {
}
ByteFlowInterface() = default;
ByteFlowInterface(const ByteFlowInterface &) = delete;
ByteFlowInterface &operator=(const ByteFlowInterface &) = delete;
@ -104,6 +106,9 @@ class ByteFlowBaseCommon : public ByteFlowInterface {
size_t get_need_size() final {
return need_size_;
}
void reset_need_size() override {
need_size_ = 0;
}
size_t get_read_size() override {
input_->sync_with_writer();
return input_->size();