From 748c9bc20505ff95e238ad2c367b6d99b7473437 Mon Sep 17 00:00:00 2001 From: Damian Day Date: Sat, 21 Sep 2019 02:18:46 +0100 Subject: [PATCH 1/2] TCP is_connected_to_host comparison error We was returning true when the state was not connected, so we would never return true when the state was connected. --- core/io/stream_peer_tcp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 310bb12bc0d..7d22176250d 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -253,7 +253,7 @@ bool StreamPeerTCP::is_connected_to_host() const { return false; } - if (status != STATUS_CONNECTED) { + if (status == STATUS_CONNECTED) { return true; } From 5631850152a161e1fe2bb9678a3728403ee7e569 Mon Sep 17 00:00:00 2001 From: Damian Day Date: Wed, 25 Sep 2019 23:45:32 +0100 Subject: [PATCH 2/2] Update stream_peer_tcp.cpp --- core/io/stream_peer_tcp.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 7d22176250d..b9c5896b24f 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -248,16 +248,7 @@ void StreamPeerTCP::set_no_delay(bool p_enabled) { bool StreamPeerTCP::is_connected_to_host() const { - if (status == STATUS_NONE || status == STATUS_ERROR) { - - return false; - } - - if (status == STATUS_CONNECTED) { - return true; - } - - return _sock.is_valid() && _sock->is_open(); + return _sock.is_valid() && _sock->is_open() && (status == STATUS_CONNECTED || status == STATUS_CONNECTING); } StreamPeerTCP::Status StreamPeerTCP::get_status() {