fix this weird issue with kicking inactive players

This commit is contained in:
RandomityGuy 2024-06-30 00:01:31 +05:30
parent f3621bba6d
commit d6f84b43f5
2 changed files with 6 additions and 0 deletions

View file

@ -30,6 +30,7 @@ class ClientConnection extends GameConnection {
var _rttRecords:Array<Float> = [];
var lastRecvTime:Float;
var didWarnTimeout:Bool = false;
var leftAlready = false;
public function new(id:Int, socket:RTCPeerConnection, datachannel:RTCDataChannel, datachannelUnreliable:RTCDataChannel) {
super(id);

View file

@ -408,6 +408,7 @@ class Net {
if (conn.needsTimeoutKick(t)) {
if (Net.isHost) {
dc.close();
onClientLeave(conn);
}
if (Net.isClient) {
disconnect();
@ -545,6 +546,10 @@ class Net {
static function onClientLeave(cc:ClientConnection) {
if (!Net.isMP || cc == null)
return;
if (cc.leftAlready)
return;
cc.leftAlready = true;
NetCommands.clientDisconnected(cc.id);
if (cc.id != 0) {