GGPO: fixed having to reset when a spectator leaves.
This commit is contained in:
parent
5148820d6e
commit
55cb594991
|
@ -90,6 +90,14 @@ UdpProtocol::SendInput(GameInput &input)
|
|||
* (better, but still ug). For the meantime, make this queue really big to decrease
|
||||
* the odds of this happening...
|
||||
*/
|
||||
|
||||
// disconnect peer when threshold is reached.
|
||||
if (_pending_output.size() == RINGBUFFSIZE - 1)
|
||||
{
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
_pending_output.push(input);
|
||||
}
|
||||
SendPendingOutput();
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#ifndef _UDP_PROTO_H_
|
||||
#define _UDP_PROTO_H_
|
||||
|
||||
#define RINGBUFFSIZE 64
|
||||
|
||||
#include "enet/enet.h"
|
||||
#include "udp_msg.h"
|
||||
#include "game_input.h"
|
||||
|
@ -167,7 +169,7 @@ protected:
|
|||
/*
|
||||
* Packet loss...
|
||||
*/
|
||||
RingBuffer<GameInput, 64> _pending_output;
|
||||
RingBuffer<GameInput, RINGBUFFSIZE> _pending_output;
|
||||
GameInput _last_received_input;
|
||||
GameInput _last_sent_input;
|
||||
GameInput _last_acked_input;
|
||||
|
|
|
@ -1072,10 +1072,6 @@ void Netplay::DropSpectator(s32 slot_id, DropPlayerReason reason)
|
|||
enet_peer_disconnect_now(s_spectators[slot_id].peer, 0);
|
||||
s_spectators[slot_id] = {};
|
||||
s_num_spectators--;
|
||||
// sadly we have to reset here. this really sucks for the active players since you dont really want to halt for a spectator.
|
||||
// not resetting seems to be creating index out of bounds errors in the ringbuffer.
|
||||
// TODO ?
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Netplay::UpdateConnectingState()
|
||||
|
|
Loading…
Reference in New Issue