Update to 5.13.1 (1829)

This commit is contained in:
DrKLO 2020-01-06 17:02:23 +03:00
parent 06f4895201
commit 31736964fa
3 changed files with 45 additions and 45 deletions

View file

@ -283,7 +283,7 @@ android {
} }
} }
defaultConfig.versionCode = 1828 defaultConfig.versionCode = 1829
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->

View file

@ -506,110 +506,110 @@ void NetworkSocketPosix::SetTimeouts(int sendTimeout, int recvTimeout){
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
} }
bool NetworkSocketPosix::Select(std::vector<NetworkSocket *> &readFds, std::vector<NetworkSocket*>& writeFds, std::vector<NetworkSocket *> &errorFds, SocketSelectCanceller* _canceller){ bool NetworkSocketPosix::Select(std::vector<NetworkSocket *> &readFds, std::vector<NetworkSocket*>& writeFds, std::vector<NetworkSocket *> &errorFds, SocketSelectCanceller* _canceller) {
fd_set readSet; fd_set readSet;
fd_set writeSet; fd_set writeSet;
fd_set errorSet; fd_set errorSet;
FD_ZERO(&readSet); FD_ZERO(&readSet);
FD_ZERO(&writeSet); FD_ZERO(&writeSet);
FD_ZERO(&errorSet); FD_ZERO(&errorSet);
SocketSelectCancellerPosix* canceller=dynamic_cast<SocketSelectCancellerPosix*>(_canceller); SocketSelectCancellerPosix *canceller = dynamic_cast<SocketSelectCancellerPosix *>(_canceller);
if(canceller) if (canceller)
FD_SET(canceller->pipeRead, &readSet); FD_SET(canceller->pipeRead, &readSet);
int maxfd=canceller ? canceller->pipeRead : 0; int maxfd = canceller ? canceller->pipeRead : 0;
for(NetworkSocket*& s:readFds){ for (NetworkSocket *&s:readFds) {
int sfd=GetDescriptorFromSocket(s); int sfd = GetDescriptorFromSocket(s);
if(sfd<=0){ if (sfd <= 0) {
LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance"); LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance");
continue; continue;
} }
FD_SET(sfd, &readSet); FD_SET(sfd, &readSet);
if(maxfd<sfd) if (maxfd < sfd)
maxfd=sfd; maxfd = sfd;
} }
for(NetworkSocket*& s:writeFds){ for (NetworkSocket *&s:writeFds) {
int sfd=GetDescriptorFromSocket(s); int sfd = GetDescriptorFromSocket(s);
if(sfd<=0){ if (sfd <= 0) {
LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance"); LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance");
continue; continue;
} }
FD_SET(sfd, &writeSet); FD_SET(sfd, &writeSet);
if(maxfd<sfd) if (maxfd < sfd)
maxfd=sfd; maxfd = sfd;
} }
bool anyFailed=false; bool anyFailed = false;
for(NetworkSocket*& s:errorFds){ for (NetworkSocket *&s:errorFds) {
int sfd=GetDescriptorFromSocket(s); int sfd = GetDescriptorFromSocket(s);
if(sfd<=0){ if (sfd <= 0) {
LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance"); LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance");
continue; continue;
} }
if(s->timeout>0 && VoIPController::GetCurrentTime()-s->lastSuccessfulOperationTime>s->timeout){ if (s->timeout > 0 && VoIPController::GetCurrentTime() - s->lastSuccessfulOperationTime > s->timeout) {
LOGW("Socket %d timed out", sfd); LOGW("Socket %d timed out", sfd);
s->failed=true; s->failed = true;
} }
anyFailed |= s->IsFailed(); anyFailed |= s->IsFailed();
FD_SET(sfd, &errorSet); FD_SET(sfd, &errorSet);
if(maxfd<sfd) if (maxfd < sfd)
maxfd=sfd; maxfd = sfd;
} }
select(maxfd+1, &readSet, &writeSet, &errorSet, NULL); select(maxfd + 1, &readSet, &writeSet, &errorSet, NULL);
if(canceller && FD_ISSET(canceller->pipeRead, &readSet) && !anyFailed){ if (canceller && FD_ISSET(canceller->pipeRead, &readSet) && !anyFailed) {
char c; char c;
(void) read(canceller->pipeRead, &c, 1); (void) read(canceller->pipeRead, &c, 1);
return false; return false;
}else if(anyFailed){ } else if (anyFailed) {
FD_ZERO(&readSet); FD_ZERO(&readSet);
FD_ZERO(&writeSet); FD_ZERO(&writeSet);
} }
std::vector<NetworkSocket*>::iterator itr=readFds.begin(); std::vector<NetworkSocket *>::iterator itr = readFds.begin();
while (itr != readFds.end()) { while (itr != readFds.end()) {
int sfd = GetDescriptorFromSocket(*itr); int sfd = GetDescriptorFromSocket(*itr);
if (sfd > 0 && FD_ISSET(sfd, &readSet)) { if (sfd > 0 && FD_ISSET(sfd, &readSet)) {
(*itr)->lastSuccessfulOperationTime = VoIPController::GetCurrentTime(); (*itr)->lastSuccessfulOperationTime = VoIPController::GetCurrentTime();
} }
if (sfd == 0 || !FD_ISSET(sfd, &readSet) || !(*itr)->OnReadyToReceive()) { if (sfd <= 0 || !FD_ISSET(sfd, &readSet) || !(*itr)->OnReadyToReceive()) {
itr = readFds.erase(itr); itr = readFds.erase(itr);
} else { } else {
++itr; ++itr;
} }
} }
itr=writeFds.begin(); itr = writeFds.begin();
while(itr!=writeFds.end()){ while (itr != writeFds.end()) {
int sfd=GetDescriptorFromSocket(*itr); int sfd = GetDescriptorFromSocket(*itr);
if(sfd==0 || !FD_ISSET(sfd, &writeSet)){ if (sfd <= 0 || !FD_ISSET(sfd, &writeSet)) {
itr=writeFds.erase(itr); itr = writeFds.erase(itr);
}else{ } else {
LOGV("Socket %d is ready to send", sfd); LOGV("Socket %d is ready to send", sfd);
(*itr)->lastSuccessfulOperationTime=VoIPController::GetCurrentTime(); (*itr)->lastSuccessfulOperationTime = VoIPController::GetCurrentTime();
if((*itr)->OnReadyToSend()) if ((*itr)->OnReadyToSend())
++itr; ++itr;
else else
itr=writeFds.erase(itr); itr = writeFds.erase(itr);
} }
} }
itr=errorFds.begin(); itr = errorFds.begin();
while(itr!=errorFds.end()){ while (itr != errorFds.end()) {
int sfd=GetDescriptorFromSocket(*itr); int sfd = GetDescriptorFromSocket(*itr);
if((sfd==0 || !FD_ISSET(sfd, &errorSet)) && !(*itr)->IsFailed()){ if ((sfd <= 0 || !FD_ISSET(sfd, &errorSet)) && !(*itr)->IsFailed()) {
itr=errorFds.erase(itr); itr = errorFds.erase(itr);
}else{ } else {
++itr; ++itr;
} }
} }
//LOGV("select fds left: read=%d, write=%d, error=%d", (int)readFds.size(), (int)writeFds.size(), (int)errorFds.size()); //LOGV("select fds left: read=%d, write=%d, error=%d", (int)readFds.size(), (int)writeFds.size(), (int)errorFds.size());
return readFds.size()>0 || errorFds.size()>0 || writeFds.size()>0; return readFds.size() > 0 || errorFds.size() > 0 || writeFds.size() > 0;
} }
SocketSelectCancellerPosix::SocketSelectCancellerPosix(){ SocketSelectCancellerPosix::SocketSelectCancellerPosix(){

View file

@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false; public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1828; public static int BUILD_VERSION = 1829;
public static String BUILD_VERSION_STRING = "5.13.0"; public static String BUILD_VERSION_STRING = "5.13.0";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";