Skip to content
This repository was archived by the owner on Feb 20, 2023. It is now read-only.

Flush pending writes on connection close #1617

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/network/connection_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ Transition ConnectionHandle::GetResult() {
}

Transition ConnectionHandle::TryCloseConnection() {
// Flush out any pending writes before closing the connection. In theory this should just be error messages and not
// partial query data, but I don't completely understand the network state machine. This is mostly to make sure we
// flush error messages on connection startup. @see PostgresProtocolInterpreter::ProcessStartup's error states
if (io_wrapper_->ShouldFlush()) TryWrite();
// Stop the protocol interpreter.
protocol_interpreter_->Teardown(io_wrapper_->GetReadBuffer(), io_wrapper_->GetWriteQueue(), traffic_cop_,
common::ManagedPointer(&context_));
Expand Down