- fixed crash in UpdateVoteStatus
- fixed clients reconnecting automatically after being kicked for desync
This commit is contained in:
@@ -557,6 +557,7 @@ namespace Barotrauma.Networking
|
|||||||
case "The server has been shut down":
|
case "The server has been shut down":
|
||||||
case "You have been banned from the server":
|
case "You have been banned from the server":
|
||||||
case "You have been kicked from the server":
|
case "You have been kicked from the server":
|
||||||
|
case "You have been disconnected because of excessive desync":
|
||||||
var msgBox = new GUIMessageBox("CONNECTION LOST", disconnectMsg);
|
var msgBox = new GUIMessageBox("CONNECTION LOST", disconnectMsg);
|
||||||
msgBox.Buttons[0].OnClicked += ReturnToServerList;
|
msgBox.Buttons[0].OnClicked += ReturnToServerList;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1669,7 +1669,8 @@ namespace Barotrauma.Networking
|
|||||||
public void UpdateVoteStatus()
|
public void UpdateVoteStatus()
|
||||||
{
|
{
|
||||||
if (server.Connections.Count == 0) return;
|
if (server.Connections.Count == 0) return;
|
||||||
|
if (connectedClients.Count == 0) return;
|
||||||
|
|
||||||
var clientsToKick = connectedClients.FindAll(c => c.KickVoteCount >= connectedClients.Count * KickVoteRequiredRatio);
|
var clientsToKick = connectedClients.FindAll(c => c.KickVoteCount >= connectedClients.Count * KickVoteRequiredRatio);
|
||||||
foreach (Client c in clientsToKick)
|
foreach (Client c in clientsToKick)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Barotrauma.Networking
|
|||||||
//it's been 10 seconds since this event was created
|
//it's been 10 seconds since this event was created
|
||||||
//kick everyone that hasn't received it yet, this is way too old
|
//kick everyone that hasn't received it yet, this is way too old
|
||||||
List<Client> toKick = clients.FindAll(c => c.inGame && c.lastRecvEntityEventID <= lastSentToAll);
|
List<Client> toKick = clients.FindAll(c => c.inGame && c.lastRecvEntityEventID <= lastSentToAll);
|
||||||
if (toKick!=null) toKick.ForEach(c => GameMain.Server.DisconnectClient(c,"","You have been disconnected because of excessive desync."));
|
if (toKick!=null) toKick.ForEach(c => GameMain.Server.DisconnectClient(c,"","You have been disconnected because of excessive desync"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user