diff options
| -rw-r--r-- | benchmark/bench_http_server_fast.cpp | 6 | ||||
| -rw-r--r-- | tdnet/td/net/HttpConnectionBase.cpp | 5 | ||||
| -rw-r--r-- | tdnet/td/net/HttpConnectionBase.h | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/benchmark/bench_http_server_fast.cpp b/benchmark/bench_http_server_fast.cpp index 0d012f112..c4353dc17 100644 --- a/benchmark/bench_http_server_fast.cpp +++ b/benchmark/bench_http_server_fast.cpp @@ -34,6 +34,10 @@ class HttpEchoConnection : public Actor { Scheduler::subscribe(fd_.get_poll_info().extract_pollable_fd(this)); reader_.init(&fd_.input_buffer(), 1024 * 1024, 0); } + void tear_down() override { + Scheduler::unsubscribe_before_close(fd_.get_poll_info().get_pollable_fd_ref()); + fd_.close(); + } void handle_query() { query_ = HttpQuery(); @@ -80,7 +84,7 @@ class HttpEchoConnection : public Actor { } }; -const int N = 4; +const int N = 8; class Server : public TcpListener::Callback { public: void start_up() override { diff --git a/tdnet/td/net/HttpConnectionBase.cpp b/tdnet/td/net/HttpConnectionBase.cpp index 9c673b323..5de245bd2 100644 --- a/tdnet/td/net/HttpConnectionBase.cpp +++ b/tdnet/td/net/HttpConnectionBase.cpp @@ -55,9 +55,12 @@ void HttpConnectionBase::tear_down() { fd_.close(); } -void HttpConnectionBase::write_next(BufferSlice buffer) { +void HttpConnectionBase::write_next_noflush(BufferSlice buffer) { CHECK(state_ == State::Write); write_buffer_.append(std::move(buffer)); +} +void HttpConnectionBase::write_next(BufferSlice buffer) { + write_next_noflush(std::move(buffer)); loop(); } diff --git a/tdnet/td/net/HttpConnectionBase.h b/tdnet/td/net/HttpConnectionBase.h index 296d342ed..bf8bf7e78 100644 --- a/tdnet/td/net/HttpConnectionBase.h +++ b/tdnet/td/net/HttpConnectionBase.h @@ -24,6 +24,7 @@ namespace detail { class HttpConnectionBase : public Actor { public: + void write_next_noflush(BufferSlice buffer); void write_next(BufferSlice buffer); void write_ok(); void write_error(Status error); |
