Send and recv all data when necessary

Expose net_recv_all() and net_send_all(), equivalent of net_recv() and
net_send(), but that waits/retries until the requested length has been
transferred.

Use these new functions where it was (wrongly) assumed that the
requested length had been transferred.
This commit is contained in:
Romain Vimont 2018-02-15 23:55:52 +01:00
commit a791c272bc
4 changed files with 23 additions and 2 deletions

View file

@ -47,7 +47,7 @@ static SDL_bool process_event(struct controller *controller, const struct contro
if (!length) {
return SDL_FALSE;
}
int w = net_send(controller->video_socket, serialized_event, length);
int w = net_send_all(controller->video_socket, serialized_event, length);
return w == length;
}