slirp: improve send_packet() callback

Use a more descriptive name for the callback.

Reuse the SlirpWriteCb type. Wrap it to check that all data has been written.

Return a ssize_t for potential error handling and data-loss reporting.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Marc-André Lureau 2019-01-17 15:43:54 +04:00 committed by Samuel Thibault
parent d7df0b41dc
commit 625a526b32
7 changed files with 33 additions and 15 deletions

View file

@ -668,9 +668,9 @@ ssize_t qemu_send_packet_async(NetClientState *sender,
buf, size, sent_cb);
}
void qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size)
ssize_t qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size)
{
qemu_send_packet_async(nc, buf, size, NULL);
return qemu_send_packet_async(nc, buf, size, NULL);
}
ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size)