From ff85d74b85bf33aa661e34b6a9e2bf037924fe0f Mon Sep 17 00:00:00 2001 From: DrKLO Date: Tue, 11 Feb 2014 18:44:02 +0400 Subject: [PATCH] Fixed datacenter port switch condition --- .../src/main/java/org/telegram/messenger/TcpConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java b/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java index 1bdf0ff57..f111120c6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java @@ -423,7 +423,7 @@ public class TcpConnection extends PyroClientAdapter { } else { FileLog.d("tmessages", "Disconnected " + TcpConnection.this); } - boolean swirchToNextPort = wasConnected && hasSomeDataSinceLastConnect; + boolean switchToNextPort = wasConnected && !hasSomeDataSinceLastConnect && timedout; firstPacket = true; restOfTheData = null; channelToken = 0; @@ -452,7 +452,7 @@ public class TcpConnection extends PyroClientAdapter { } if (ConnectionsManager.isNetworkOnline()) { isNextPort = true; - if (failedConnectionCount > willRetryConnectCount || swirchToNextPort) { + if (failedConnectionCount > willRetryConnectCount || switchToNextPort) { Datacenter datacenter = ConnectionsManager.Instance.datacenterWithId(datacenterId); datacenter.nextAddressOrPort(); failedConnectionCount = 0;