Skip to content

Commit

Permalink
Fix unable to test Shadowsocks nodes on Windows
Browse files Browse the repository at this point in the history
Optimize codes.
  • Loading branch information
tindy2013 committed Oct 7, 2020
1 parent 3ad87dc commit 56f0f23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int runClient(int client)
std::string ssr_libev_path = "tools\\clients\\ssr-local.exe -u -c config.json";

std::string ss_libev_dir = "tools\\clients\\";
std::string ss_libev_path = ss_libev_dir + "ss-local.exe -u -c ..\\..\\..\\config.json";
std::string ss_libev_path = ss_libev_dir + "ss-local.exe -u -c ..\\..\\config.json";

std::string ssr_win_dir = "tools\\clients\\";
std::string ssr_win_path = ssr_win_dir + "shadowsocksr-win.exe";
Expand Down Expand Up @@ -379,7 +379,7 @@ int terminateClient(int client)
return 0;
}

void readConf(const std::string &path)
void readConf(std::string path)
{
downloadLink link;
linkMatchRule rule;
Expand All @@ -390,7 +390,7 @@ void readConf(const std::string &path)
std::string strTemp;

//ini.do_utf8_to_gbk = true;
ini.ParseFile("pref.ini");
ini.ParseFile(path);

ini.EnterSection("common");
if(ini.ItemPrefixExist("exclude_remark"))
Expand Down
7 changes: 3 additions & 4 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,17 @@ std::string hostnameToIPAddr(std::string host)
int retVal;
std::string retstr;
struct addrinfo hint = {}, *retAddrInfo = NULL, *cur;
defer(if(retAddrInfo) freeaddrinfo(retAddrInfo));
retVal = getaddrinfo(host.data(), NULL, &hint, &retAddrInfo);
if(retVal != 0)
{
return std::string();
}

for(cur = retAddrInfo; cur != NULL; cur = cur->ai_next)
{
if((retstr = sockaddrToIPAddr(cur->ai_addr)).size())
retstr = sockaddrToIPAddr(cur->ai_addr);
if(!retstr.empty())
break;
}
freeaddrinfo(retAddrInfo);
return retstr;
}

Expand Down

0 comments on commit 56f0f23

Please sign in to comment.