mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-04 10:10:32 +01:00
Update to 5.13.1 (1829)
This commit is contained in:
parent
06f4895201
commit
31736964fa
@ -283,7 +283,7 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 1828
|
||||
defaultConfig.versionCode = 1829
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
|
@ -506,110 +506,110 @@ void NetworkSocketPosix::SetTimeouts(int sendTimeout, int recvTimeout){
|
||||
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 writeSet;
|
||||
fd_set errorSet;
|
||||
FD_ZERO(&readSet);
|
||||
FD_ZERO(&writeSet);
|
||||
FD_ZERO(&errorSet);
|
||||
SocketSelectCancellerPosix* canceller=dynamic_cast<SocketSelectCancellerPosix*>(_canceller);
|
||||
if(canceller)
|
||||
SocketSelectCancellerPosix *canceller = dynamic_cast<SocketSelectCancellerPosix *>(_canceller);
|
||||
if (canceller)
|
||||
FD_SET(canceller->pipeRead, &readSet);
|
||||
|
||||
int maxfd=canceller ? canceller->pipeRead : 0;
|
||||
int maxfd = canceller ? canceller->pipeRead : 0;
|
||||
|
||||
for(NetworkSocket*& s:readFds){
|
||||
int sfd=GetDescriptorFromSocket(s);
|
||||
if(sfd<=0){
|
||||
for (NetworkSocket *&s:readFds) {
|
||||
int sfd = GetDescriptorFromSocket(s);
|
||||
if (sfd <= 0) {
|
||||
LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance");
|
||||
continue;
|
||||
}
|
||||
FD_SET(sfd, &readSet);
|
||||
if(maxfd<sfd)
|
||||
maxfd=sfd;
|
||||
if (maxfd < sfd)
|
||||
maxfd = sfd;
|
||||
}
|
||||
|
||||
for(NetworkSocket*& s:writeFds){
|
||||
int sfd=GetDescriptorFromSocket(s);
|
||||
if(sfd<=0){
|
||||
for (NetworkSocket *&s:writeFds) {
|
||||
int sfd = GetDescriptorFromSocket(s);
|
||||
if (sfd <= 0) {
|
||||
LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance");
|
||||
continue;
|
||||
}
|
||||
FD_SET(sfd, &writeSet);
|
||||
if(maxfd<sfd)
|
||||
maxfd=sfd;
|
||||
if (maxfd < sfd)
|
||||
maxfd = sfd;
|
||||
}
|
||||
|
||||
bool anyFailed=false;
|
||||
bool anyFailed = false;
|
||||
|
||||
for(NetworkSocket*& s:errorFds){
|
||||
int sfd=GetDescriptorFromSocket(s);
|
||||
if(sfd<=0){
|
||||
for (NetworkSocket *&s:errorFds) {
|
||||
int sfd = GetDescriptorFromSocket(s);
|
||||
if (sfd <= 0) {
|
||||
LOGW("can't select on one of sockets because it's not a NetworkSocketPosix instance");
|
||||
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);
|
||||
s->failed=true;
|
||||
s->failed = true;
|
||||
}
|
||||
anyFailed |= s->IsFailed();
|
||||
FD_SET(sfd, &errorSet);
|
||||
if(maxfd<sfd)
|
||||
maxfd=sfd;
|
||||
if (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;
|
||||
(void) read(canceller->pipeRead, &c, 1);
|
||||
return false;
|
||||
}else if(anyFailed){
|
||||
} else if (anyFailed) {
|
||||
FD_ZERO(&readSet);
|
||||
FD_ZERO(&writeSet);
|
||||
}
|
||||
|
||||
std::vector<NetworkSocket*>::iterator itr=readFds.begin();
|
||||
std::vector<NetworkSocket *>::iterator itr = readFds.begin();
|
||||
while (itr != readFds.end()) {
|
||||
int sfd = GetDescriptorFromSocket(*itr);
|
||||
if (sfd > 0 && FD_ISSET(sfd, &readSet)) {
|
||||
(*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);
|
||||
} else {
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
itr=writeFds.begin();
|
||||
while(itr!=writeFds.end()){
|
||||
int sfd=GetDescriptorFromSocket(*itr);
|
||||
if(sfd==0 || !FD_ISSET(sfd, &writeSet)){
|
||||
itr=writeFds.erase(itr);
|
||||
}else{
|
||||
itr = writeFds.begin();
|
||||
while (itr != writeFds.end()) {
|
||||
int sfd = GetDescriptorFromSocket(*itr);
|
||||
if (sfd <= 0 || !FD_ISSET(sfd, &writeSet)) {
|
||||
itr = writeFds.erase(itr);
|
||||
} else {
|
||||
LOGV("Socket %d is ready to send", sfd);
|
||||
(*itr)->lastSuccessfulOperationTime=VoIPController::GetCurrentTime();
|
||||
if((*itr)->OnReadyToSend())
|
||||
(*itr)->lastSuccessfulOperationTime = VoIPController::GetCurrentTime();
|
||||
if ((*itr)->OnReadyToSend())
|
||||
++itr;
|
||||
else
|
||||
itr=writeFds.erase(itr);
|
||||
itr = writeFds.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
itr=errorFds.begin();
|
||||
while(itr!=errorFds.end()){
|
||||
int sfd=GetDescriptorFromSocket(*itr);
|
||||
if((sfd==0 || !FD_ISSET(sfd, &errorSet)) && !(*itr)->IsFailed()){
|
||||
itr=errorFds.erase(itr);
|
||||
}else{
|
||||
itr = errorFds.begin();
|
||||
while (itr != errorFds.end()) {
|
||||
int sfd = GetDescriptorFromSocket(*itr);
|
||||
if ((sfd <= 0 || !FD_ISSET(sfd, &errorSet)) && !(*itr)->IsFailed()) {
|
||||
itr = errorFds.erase(itr);
|
||||
} else {
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
//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(){
|
||||
|
@ -19,7 +19,7 @@ public class BuildVars {
|
||||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
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 int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
Loading…
Reference in New Issue
Block a user