diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 601e9ba4..a1cec90c 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -83,7 +83,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 286 + versionCode 287 versionName "1.6.1" } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionContext.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionContext.java index 38bcba64..5277acd5 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionContext.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionContext.java @@ -74,6 +74,9 @@ public class ConnectionContext extends PyroClientAdapter { } public void addMessageToConfirm(long messageId) { + if (messagesIdsForConfirmation.contains(messageId)) { + return; + } messagesIdsForConfirmation.add(messageId); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index ca032f9e..4456e8e9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -1095,6 +1095,10 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } } + if (request.transportChannelToken != 0 && request.transportChannelToken != connection.channelToken) { + request.lastResendTime = 0; + } + request.retryCount++; NetworkMessage networkMessage = new NetworkMessage(); networkMessage.protoMessage = new TLRPC.TL_protoMessage(); @@ -1729,7 +1733,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. }); } - void rpcCompleted(final long requestMsgId) { + private void rpcCompleted(final long requestMsgId) { Utilities.stageQueue.postRunnable(new Runnable() { @Override public void run() { @@ -1920,6 +1924,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. futureSalts.freeResources(); messagesConfirmed(requestMid); + request.completed = true; rpcCompleted(requestMid); break; @@ -2135,6 +2140,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. FileLog.e("tmessages", "rpc is init, but init connection already completed"); } } + request.completed = true; rpcCompleted(resultMid); } else { request.runningMessageId = 0; @@ -2220,11 +2226,14 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. boolean confirm = true; if (detailedInfo instanceof TLRPC.TL_msg_detailed_info) { - long requestMid = ((TLRPC.TL_msg_detailed_info)detailedInfo).msg_id; for (RPCRequest request : runningRequests) { - if (request.respondsToMessageId(requestMid)) { + if (request.respondsToMessageId(detailedInfo.msg_id)) { + if (request.completed) { + break; + } if ((request.flags & RPCRequest.RPCRequestClassDownloadMedia) != 0) { - if (request.runningStartTime + 60 < System.currentTimeMillis() / 1000) { + if (request.lastResendTime == 0 || request.lastResendTime + 60 < (int)(System.currentTimeMillis() / 1000)) { + request.lastResendTime = (int)(System.currentTimeMillis() / 1000); requestResend = true; } else { confirm = false; @@ -2252,10 +2261,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ArrayList arr = new ArrayList(); arr.add(networkMessage); sendMessagesToTransport(arr, connection, false); - } else { - if (confirm) { - connection.addMessageToConfirm(detailedInfo.answer_msg_id); - } + } else if (confirm) { + connection.addMessageToConfirm(detailedInfo.answer_msg_id); } } else if (message instanceof TLRPC.TL_gzip_packed) { TLRPC.TL_gzip_packed packet = (TLRPC.TL_gzip_packed)message; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java b/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java index aa40b7bd..35ef4d11 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java @@ -35,7 +35,9 @@ public class RPCRequest { int serverFailureCount; int flags; - public int retryCount = 0; + protected int retryCount = 0; + protected int lastResendTime = 0; + protected boolean completed = false; TLObject rawRequest; TLObject rpcRequest; diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index 596ca1e1..2fa92138 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -275,7 +275,7 @@ Nur wenn Bildschirm „an“ Nur wenn Bildschirm „aus“ Popups immer anzeigen - Badge Number + Nummer auf Symbol Noch keine geteilten Medien vorhanden