fixed mod downloading stuck at 50%

This commit is contained in:
Anonymous275 2020-12-22 19:38:01 +02:00
parent 76a1b05056
commit 7cd25fbb22
2 changed files with 4 additions and 4 deletions

View File

@ -243,6 +243,7 @@ void SyncResources(SOCKET Sock){
Amount++; Amount++;
} }
if(!FNames.empty())info("Syncing..."); if(!FNames.empty())info("Syncing...");
SOCKET DSock = InitDSock();
for(auto FN = FNames.begin(),FS = FSizes.begin(); FN != FNames.end() && !Terminate; ++FN,++FS) { for(auto FN = FNames.begin(),FS = FSizes.begin(); FN != FNames.end() && !Terminate; ++FN,++FS) {
auto pos = FN->find_last_of('/'); auto pos = FN->find_last_of('/');
if (pos != std::string::npos) { if (pos != std::string::npos) {
@ -271,7 +272,6 @@ void SyncResources(SOCKET Sock){
} }
CheckForDir(); CheckForDir();
std::string FName = a.substr(a.find_last_of('/')); std::string FName = a.substr(a.find_last_of('/'));
SOCKET DSock = InitDSock();
do { do {
TCPSend("f" + *FN,Sock); TCPSend("f" + *FN,Sock);
@ -296,7 +296,6 @@ void SyncResources(SOCKET Sock){
} }
}while(fs::file_size(a) != std::stoi(*FS) && !Terminate); }while(fs::file_size(a) != std::stoi(*FS) && !Terminate);
KillSocket(DSock);
if(!Terminate){ if(!Terminate){
if(!fs::exists(GetGamePath() + "mods/multiplayer")){ if(!fs::exists(GetGamePath() + "mods/multiplayer")){
fs::create_directory(GetGamePath() + "mods/multiplayer"); fs::create_directory(GetGamePath() + "mods/multiplayer");
@ -305,6 +304,7 @@ void SyncResources(SOCKET Sock){
} }
WaitForConfirm(); WaitForConfirm();
} }
KillSocket(DSock);
if(!Terminate){ if(!Terminate){
TCPSend("Done",Sock); TCPSend("Done",Sock);
info("Done!"); info("Done!");

View File

@ -27,7 +27,7 @@ std::string GetVer(){
return "1.80"; return "1.80";
} }
std::string GetPatch(){ std::string GetPatch(){
return ".1"; return ".2";
} }
void ReLaunch(int argc,char*args[]){ void ReLaunch(int argc,char*args[]){
std::string Arg; std::string Arg;
@ -182,7 +182,7 @@ void InitLauncher(int argc, char* argv[]) {
CheckName(argc, argv); CheckName(argc, argv);
CheckLocalKey(); //will replace RequestRole CheckLocalKey(); //will replace RequestRole
Discord_Main(); Discord_Main();
//Dev = true; Dev = true;
//RequestRole(); //RequestRole();
CustomPort(argc, argv); CustomPort(argc, argv);
CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch()); CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch());