test-channel: Use socket compatibility layer

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Frediano Ziglio 2018-06-24 19:50:59 +01:00
parent 5ab0667eff
commit c8ab3c2c98

View File

@ -183,7 +183,7 @@ static void send_ack_sync(int socket, uint32_t generation)
msg.len = GUINT32_TO_LE(sizeof(generation));
msg.generation = GUINT32_TO_LE(generation);
g_assert_cmpint(write(socket, &msg.type, 10), ==, 10);
g_assert_cmpint(socket_write(socket, &msg.type, 10), ==, 10);
}
static SpiceTimer *waked_up_timer;
@ -198,7 +198,7 @@ static void timer_wakeup(void *opaque)
ssize_t len;
alarm(1);
char buffer[256];
while ((len=recv(client_socket, buffer, sizeof(buffer), 0)) > 0)
while ((len=socket_read(client_socket, buffer, sizeof(buffer))) > 0)
got_data += len;
alarm(0);
@ -218,7 +218,7 @@ static void timeout_watch_count(void *opaque)
// get all pending data
alarm(1);
char buffer[256];
while (recv(client_socket, buffer, sizeof(buffer), 0) > 0)
while (socket_read(client_socket, buffer, sizeof(buffer)) > 0)
continue;
alarm(0);
@ -226,7 +226,7 @@ static void timeout_watch_count(void *opaque)
watch_called_countdown = 20;
// send ack reply, this should unblock data from RedChannelClient
g_assert_cmpint(write(client_socket, "\2\0\0\0\0\0", 6), ==, 6);
g_assert_cmpint(socket_write(client_socket, "\2\0\0\0\0\0", 6), ==, 6);
// expect data soon
waked_up_timer = core->timer_add(timer_wakeup, core);