mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 19:39:24 +01:00
Client network message fixes
This commit is contained in:
parent
401784e95e
commit
cf043c2fa5
@ -587,25 +587,18 @@ bool Network::SendUpdateDirect(struct sockaddr_in *addr, NetworkUpdate *src)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)src;
|
||||
size_t sz;
|
||||
ssize_t v;
|
||||
|
||||
sz = src->size + sizeof(NetworkUpdate); /* stop */
|
||||
sz = ntohl(src->size) + sizeof(NetworkUpdate); /* stop */
|
||||
if (sz <= 0)
|
||||
return false;
|
||||
|
||||
size_t cur_sz = 0;
|
||||
do
|
||||
{
|
||||
size_t size_to_send = this->FillNetworkBuffer((NetworkUpdate*)p);
|
||||
ssize_t v;
|
||||
|
||||
printf("Sending %d bytes\n", sz);
|
||||
v = this->SendTo((void*)p, this->sock,
|
||||
size_to_send, addr);
|
||||
if (v <= 0 || (size_t)v != size_to_send)
|
||||
sz, addr);
|
||||
if (v <= 0 || (size_t)v != sz)
|
||||
return false;
|
||||
cur_sz += size_to_send;
|
||||
p += size_to_send;
|
||||
} while (cur_sz < sz);
|
||||
this->traffic += cur_sz;
|
||||
this->traffic += sz;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user