mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 12:41:40 +00:00
fix this weird issue with kicking inactive players
This commit is contained in:
parent
d57740f003
commit
0ec12fb0ed
2 changed files with 6 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ class ClientConnection extends GameConnection {
|
||||||
var _rttRecords:Array<Float> = [];
|
var _rttRecords:Array<Float> = [];
|
||||||
var lastRecvTime:Float;
|
var lastRecvTime:Float;
|
||||||
var didWarnTimeout:Bool = false;
|
var didWarnTimeout:Bool = false;
|
||||||
|
var leftAlready = false;
|
||||||
|
|
||||||
public function new(id:Int, socket:RTCPeerConnection, datachannel:RTCDataChannel, datachannelUnreliable:RTCDataChannel) {
|
public function new(id:Int, socket:RTCPeerConnection, datachannel:RTCDataChannel, datachannelUnreliable:RTCDataChannel) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
|
||||||
|
|
@ -408,6 +408,7 @@ class Net {
|
||||||
if (conn.needsTimeoutKick(t)) {
|
if (conn.needsTimeoutKick(t)) {
|
||||||
if (Net.isHost) {
|
if (Net.isHost) {
|
||||||
dc.close();
|
dc.close();
|
||||||
|
onClientLeave(conn);
|
||||||
}
|
}
|
||||||
if (Net.isClient) {
|
if (Net.isClient) {
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|
@ -545,6 +546,10 @@ class Net {
|
||||||
static function onClientLeave(cc:ClientConnection) {
|
static function onClientLeave(cc:ClientConnection) {
|
||||||
if (!Net.isMP || cc == null)
|
if (!Net.isMP || cc == null)
|
||||||
return;
|
return;
|
||||||
|
if (cc.leftAlready)
|
||||||
|
return;
|
||||||
|
cc.leftAlready = true;
|
||||||
|
|
||||||
NetCommands.clientDisconnected(cc.id);
|
NetCommands.clientDisconnected(cc.id);
|
||||||
|
|
||||||
if (cc.id != 0) {
|
if (cc.id != 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue