Actually receive disconnects, allow server updates

This commit is contained in:
simon.kagstrom 2009-01-29 20:48:58 +00:00
parent 1fc28d9bbf
commit 3c3d364190
3 changed files with 14 additions and 2 deletions

View File

@ -576,6 +576,16 @@ void C64::network_vblank()
Uint8 *master = this->TheDisplay->BitmapBase();
NetworkClient *remote = this->network_server->clients[i];
if (remote->ReceiveUpdate() == true)
{
if (remote->DecodeUpdate(NULL, true) == false)
{
/* Disconnect or sending crap, remove this guy! */
this->network_server->RemoveClient(remote);
continue;
}
}
remote->EncodeDisplay(master, remote->screen);
if (remote->SendUpdate() == false)
{

View File

@ -568,7 +568,7 @@ bool Network::DeMarshalData(NetworkUpdate *p)
return true;
}
bool Network::DecodeUpdate(uint8 *screen)
bool Network::DecodeUpdate(uint8 *screen, bool server)
{
NetworkUpdate *p = this->ud;
bool out = true;
@ -580,6 +580,8 @@ bool Network::DecodeUpdate(uint8 *screen)
case DISPLAY_UPDATE_RAW:
case DISPLAY_UPDATE_RLE:
case DISPLAY_UPDATE_DIFF:
if (screen == NULL)
break;
if (this->DecodeDisplayUpdate(screen, p) == false)
out = false;
break;

View File

@ -53,7 +53,7 @@ public:
size_t EncodeDisplay(Uint8 *master, Uint8 *remote);
bool DecodeUpdate(uint8 *screen);
bool DecodeUpdate(uint8 *screen, bool server = false);
void ResetNetworkUpdate(void);