TCPStreamPusherSockets: Improve handling of existing connection
Build Packages / build:rpm (rocky8_nocuda) (push) Has been cancelled
Build Packages / build:rpm (rocky9_nocuda) (push) Has been cancelled
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Has been cancelled
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Has been cancelled
Build Packages / build:rpm (rocky8_sls9) (push) Has been cancelled
Build Packages / build:rpm (rocky9_sls9) (push) Has been cancelled
Build Packages / build:rpm (rocky8) (push) Has been cancelled
Build Packages / build:rpm (rocky9) (push) Has been cancelled
Build Packages / build:rpm (ubuntu2204) (push) Has been cancelled
Build Packages / build:rpm (ubuntu2404) (push) Has been cancelled
Build Packages / Generate python client (push) Has been cancelled
Build Packages / Build documentation (push) Has been cancelled
Build Packages / Unit tests (push) Has been cancelled
Build Packages / Create release (push) Has been cancelled

This commit is contained in:
2026-03-01 20:31:09 +01:00
parent 38d8491c2b
commit 2967bcac42
2 changed files with 15 additions and 3 deletions
+7 -1
View File
@@ -99,8 +99,14 @@ void TCPStreamPusherSocket::CloseDataSocket() {
bool TCPStreamPusherSocket::AcceptConnection(std::chrono::milliseconds timeout) {
std::unique_lock ul(send_mutex);
CloseDataSocket();
// Reuse existing healthy connection instead of always forcing reconnect.
if (fd.load() >= 0 && IsConnectionAlive()) {
broken = false;
logger.Info("TCP peer already connected on " + endpoint + ", reusing existing connection");
return true;
}
CloseDataSocket();
broken = false;
pollfd pfd{};