mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix this weird issue with kicking inactive players
This commit is contained in:
parent
f3621bba6d
commit
d6f84b43f5
2 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue