Jelajahi Sumber

hostAddress can be localhost, return from justConnectToServer() is maximum number of attempts is exceeded

Alexander Wilms 2 tahun lalu
induk
melakukan
e1401d26c5
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      client/CServerHandler.cpp

+ 2 - 2
client/CServerHandler.cpp

@@ -260,7 +260,7 @@ void CServerHandler::justConnectToServer(const std::string & addr, const ui16 po
 	boost::chrono::duration<long, boost::ratio<1, 1000>> sleepDuration{};
 	boost::chrono::duration<long, boost::ratio<1, 1000>> sleepDuration{};
 	int maxConnectionAttempts;
 	int maxConnectionAttempts;
 	
 	
-	if(hostAddress == "127.0.0.1")
+	if(hostAddress == "127.0.0.1" || hostAddress == "localhost")
 	{
 	{
 		sleepDuration = boost::chrono::milliseconds(10);
 		sleepDuration = boost::chrono::milliseconds(10);
 		maxConnectionAttempts = 100;
 		maxConnectionAttempts = 100;
@@ -281,7 +281,7 @@ void CServerHandler::justConnectToServer(const std::string & addr, const ui16 po
 		if(connectionAttemptCount > maxConnectionAttempts)
 		if(connectionAttemptCount > maxConnectionAttempts)
 		{
 		{
 			logNetwork->error("\nExceeded maximum of %d connection attempts", maxConnectionAttempts);
 			logNetwork->error("\nExceeded maximum of %d connection attempts", maxConnectionAttempts);
-			break;
+			return;
 		}
 		}
 
 
 		try
 		try