Reset connection state after finishing with it in http_handler

This commit is contained in:
2025-09-14 21:16:41 -04:00
parent 632113f792
commit 1f61f91bf5
7 changed files with 71 additions and 47 deletions

View File

@@ -42,8 +42,8 @@ static thread_local std::vector<Arena> g_arenas_to_free;
Connection::Connection(struct sockaddr_storage addr, int fd, int64_t id,
size_t epoll_index, ConnectionHandler *handler,
WeakRef<Server> server)
: fd_(fd), id_(id), epoll_index_(epoll_index), addr_(addr),
handler_(handler), server_(std::move(server)) {
: id_(id), epoll_index_(epoll_index), addr_(addr), handler_(handler),
server_(std::move(server)), fd_(fd) {
auto server_ref = server_.lock();
// Should only be called from the io thread
assert(server_ref);
@@ -256,7 +256,6 @@ uint32_t Connection::write_bytes() {
{
std::lock_guard lock(mutex_);
if (message_queue_.empty()) {
result |= Drained;
auto server = server_.lock();
if (server) {
struct epoll_event event;