Throttle before encoding display, otherwise updates can be missed

This commit is contained in:
simon.kagstrom 2009-02-02 18:36:51 +00:00
parent 8c73c900df
commit a0a3097dec
2 changed files with 10 additions and 8 deletions

View File

@ -599,18 +599,18 @@ void C64::network_vblank()
}
remote->ResetNetworkUpdate();
/* Perhaps send updates to the other side (what is determinted by
* if this is the master or not) */
remote->EncodeJoystickUpdate(*js);
remote->EncodeDisplay(master, remote->GetScreen());
if (this->network_connection_type == MASTER &&
if (this->network_connection_type == MASTER &&
remote->ThrottleTraffic()) {
/* Skip this frame if the data rate is too high */
has_throttled = true;
continue;
}
/* Perhaps send updates to the other side (what is determined by
* if this is the master or not) */
remote->EncodeJoystickUpdate(*js);
remote->EncodeDisplay(master, remote->GetScreen());
if (remote->SendUpdate() == false)
{
/* Disconnect or broken data */

View File

@ -456,9 +456,12 @@ void Network::DrawTransferredBlocks(SDL_Surface *screen)
bool Network::ReceiveUpdate()
{
struct timeval tv;
bool out;
memset(&tv, 0, sizeof(tv));
return this->ReceiveUpdate(this->ud, &tv);
out = this->ReceiveUpdate(this->ud, &tv);
return out;
}
bool Network::ReceiveUpdate(NetworkUpdate *dst, struct timeval *tv)
@ -525,7 +528,6 @@ bool Network::SendUpdate()
return true;
}
void Network::AddNetworkUpdate(NetworkUpdate *update)
{
size_t sz = update->size;