From 943b394946dfc0766db33c28c89efc10c0911028 Mon Sep 17 00:00:00 2001 From: Yorick de Wid Date: Tue, 16 Apr 2024 10:32:11 +0200 Subject: [PATCH] FIX: Return if TCP is in STATUS_CONNECTED If the `StreamPeerTCP` is polled and the TCP connection is `STATUS_CONNECTED` it should return after polling netsocket. Without `return` poll keeps calling `_sock->connect_to_host` and `connect()`. (cherry picked from commit 61a2f5c53414eb471103a452a07228962a2d876a) --- CHANGELOG.md | 4 ++++ core/io/stream_peer_tcp.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1faed96e6f0..e5d723bc19e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -217,6 +217,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix NavigationObstacle elevation ([GH-84830](https://github.com/godotengine/godot/pull/84830)). - Fix NavigationObstacle height ([GH-84857](https://github.com/godotengine/godot/pull/84857)). +#### Networking + +- Fix missing return in `StreamPeerTCP::poll` when connection is `STATUS_CONNECTED` ([GH-90741](https://github.com/godotengine/godot/pull/90741)). + #### Particles - Fix several Material texture parameter updates ([GH-84303](https://github.com/godotengine/godot/pull/84303)). diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 2b9487b9e1f..90a8f49a758 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -51,6 +51,7 @@ Error StreamPeerTCP::poll() { status = STATUS_ERROR; return err; } + return OK; } else if (status != STATUS_CONNECTING) { return OK; }