- fixed server validating its own name instead of the name of a client who's logging in
- clients automatically reconnect to the server when the connection is lost and return back to server list if they fail to reconnect - showing the error msg as a GUIMessageBox and returning to main menu if starting a server fails
This commit is contained in:
@@ -124,31 +124,6 @@ namespace Barotrauma.Networking
|
||||
string clPackageName = inc.ReadString();
|
||||
string clPackageHash = inc.ReadString();
|
||||
|
||||
if (clVersion != GameMain.Version.ToString())
|
||||
{
|
||||
inc.SenderConnection.Disconnect("Version " + GameMain.Version + " required to connect to the server (Your version: " + clVersion + ")");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
unauthClient = null;
|
||||
DebugConsole.NewMessage(name + " couldn't join the server (wrong game version)", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (clPackageName != GameMain.SelectedPackage.Name)
|
||||
{
|
||||
inc.SenderConnection.Disconnect("Your content package (" + clPackageName + ") doesn't match the server's version (" + GameMain.SelectedPackage.Name + ")");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
unauthClient = null;
|
||||
DebugConsole.NewMessage(name + " couldn't join the server (wrong content package name)", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (clPackageHash != GameMain.SelectedPackage.MD5hash.Hash)
|
||||
{
|
||||
unauthClient.Connection.Disconnect("Your content package (MD5: " + clPackageHash + ") doesn't match the server's version (MD5: " + GameMain.SelectedPackage.MD5hash.Hash + ")");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
unauthClient = null;
|
||||
DebugConsole.NewMessage(name + " couldn't join the server (wrong content package hash)", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
string clName = Client.SanitizeName(inc.ReadString());
|
||||
if (string.IsNullOrWhiteSpace(clName))
|
||||
{
|
||||
@@ -157,14 +132,39 @@ namespace Barotrauma.Networking
|
||||
unauthClient = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!whitelist.IsWhiteListed(name, inc.SenderConnection.RemoteEndPoint.Address.ToString()))
|
||||
|
||||
if (clVersion != GameMain.Version.ToString())
|
||||
{
|
||||
inc.SenderConnection.Disconnect("You're not in this server's whitelist.");
|
||||
DebugConsole.NewMessage(name + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (not in whitelist)", Color.Red);
|
||||
inc.SenderConnection.Disconnect("Version " + GameMain.Version + " required to connect to the server (Your version: " + clVersion + ")");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
unauthClient = null;
|
||||
DebugConsole.NewMessage(clName + " couldn't join the server (wrong game version)", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (!Client.IsValidName(name))
|
||||
if (clPackageName != GameMain.SelectedPackage.Name)
|
||||
{
|
||||
inc.SenderConnection.Disconnect("Your content package (" + clPackageName + ") doesn't match the server's version (" + GameMain.SelectedPackage.Name + ")");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
unauthClient = null;
|
||||
DebugConsole.NewMessage(clName + " couldn't join the server (wrong content package name)", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (clPackageHash != GameMain.SelectedPackage.MD5hash.Hash)
|
||||
{
|
||||
unauthClient.Connection.Disconnect("Your content package (MD5: " + clPackageHash + ") doesn't match the server's version (MD5: " + GameMain.SelectedPackage.MD5hash.Hash + ")");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
unauthClient = null;
|
||||
DebugConsole.NewMessage(clName + " couldn't join the server (wrong content package hash)", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!whitelist.IsWhiteListed(clName, inc.SenderConnection.RemoteEndPoint.Address.ToString()))
|
||||
{
|
||||
inc.SenderConnection.Disconnect("You're not in this server's whitelist.");
|
||||
DebugConsole.NewMessage(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (not in whitelist)", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (!Client.IsValidName(clName))
|
||||
{
|
||||
unauthClient.Connection.Disconnect("Your name contains illegal symbols.");
|
||||
unauthenticatedClients.Remove(unauthClient);
|
||||
|
||||
Reference in New Issue
Block a user