From 366094fa9ccc88e8ab6ac42cdab13bb0e5664caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 9 Feb 2011 21:44:45 +0100 Subject: [PATCH] server: rename s/peer/stream This is stylish change again. We are talking about a RedStream object, so let's just name the variable "stream" everywhere, to avoid confusion with a non existent RedPeer object. https://bugs.freedesktop.org/show_bug.cgi?id=34795 --- server/inputs_channel.c | 10 ++-- server/main_channel.c | 12 ++-- server/red_channel.c | 48 +++++++------- server/red_channel.h | 6 +- server/red_dispatcher.c | 8 +- server/red_tunnel_worker.c | 12 ++-- server/red_worker.c | 56 ++++++++-------- server/reds.c | 147 ++++++++++++++++++++++---------------------- server/reds.h | 2 +- server/smartcard.c | 4 +- server/snd_worker.c | 44 +++++++------- 11 files changed, 175 insertions(+), 174 deletions(-) diff --git a/server/inputs_channel.c b/server/inputs_channel.c index ebf915c..551da27 100644 --- a/server/inputs_channel.c +++ b/server/inputs_channel.c @@ -494,14 +494,14 @@ static int inputs_channel_config_socket(RedChannel *channel) int flags; int delay_val = 1; - if (setsockopt(channel->peer->socket, IPPROTO_TCP, TCP_NODELAY, + if (setsockopt(channel->stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); return FALSE; } - if ((flags = fcntl(channel->peer->socket, F_GETFL)) == -1 || - fcntl(channel->peer->socket, F_SETFL, flags | O_ASYNC) == -1) { + if ((flags = fcntl(channel->stream->socket, F_GETFL)) == -1 || + fcntl(channel->stream->socket, F_SETFL, flags | O_ASYNC) == -1) { red_printf("fcntl failed, %s", strerror(errno)); return FALSE; } @@ -512,7 +512,7 @@ static void inputs_channel_hold_pipe_item(PipeItem *item) { } -static void inputs_link(Channel *channel, RedsStream *peer, int migration, +static void inputs_link(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { @@ -521,7 +521,7 @@ static void inputs_link(Channel *channel, RedsStream *peer, int migration, ASSERT(channel->data == NULL); g_inputs_channel = inputs_channel = (InputsChannel*)red_channel_create_parser( - sizeof(*inputs_channel), peer, core, migration, FALSE /* handle_acks */ + sizeof(*inputs_channel), stream, core, migration, FALSE /* handle_acks */ ,inputs_channel_config_socket ,spice_get_client_channel_parser(SPICE_CHANNEL_INPUTS, NULL) ,inputs_channel_handle_parsed diff --git a/server/main_channel.c b/server/main_channel.c index f43f89a..d24c7aa 100644 --- a/server/main_channel.c +++ b/server/main_channel.c @@ -780,7 +780,7 @@ static void main_channel_hold_pipe_item(PipeItem *item) { } -static void main_channel_link(Channel *channel, RedsStream *peer, int migration, +static void main_channel_link(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { @@ -789,7 +789,7 @@ static void main_channel_link(Channel *channel, RedsStream *peer, int migration, ASSERT(channel->data == NULL); main_chan = (MainChannel*)red_channel_create_parser( - sizeof(*main_chan), peer, core, migration, FALSE /* handle_acks */ + sizeof(*main_chan), stream, core, migration, FALSE /* handle_acks */ ,main_channel_config_socket ,spice_get_client_channel_parser(SPICE_CHANNEL_MAIN, NULL) ,main_channel_handle_parsed @@ -808,22 +808,22 @@ int main_channel_getsockname(Channel *channel, struct sockaddr *sa, socklen_t *s { MainChannel *main_chan = channel->data; - return main_chan ? getsockname(main_chan->base.peer->socket, sa, salen) : -1; + return main_chan ? getsockname(main_chan->base.stream->socket, sa, salen) : -1; } int main_channel_getpeername(Channel *channel, struct sockaddr *sa, socklen_t *salen) { MainChannel *main_chan = channel->data; - return main_chan ? getpeername(main_chan->base.peer->socket, sa, salen) : -1; + return main_chan ? getpeername(main_chan->base.stream->socket, sa, salen) : -1; } void main_channel_close(Channel *channel) { MainChannel *main_chan = channel->data; - if (main_chan && main_chan->base.peer) { - close(main_chan->base.peer->socket); + if (main_chan && main_chan->base.stream) { + close(main_chan->base.stream->socket); } } diff --git a/server/red_channel.c b/server/red_channel.c index 3676b5a..b077bcd 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -33,15 +33,15 @@ static PipeItem *red_channel_pipe_get(RedChannel *channel); static void red_channel_event(int fd, int event, void *data); /* return the number of bytes read. -1 in case of error */ -static int red_peer_receive(RedsStream *peer, uint8_t *buf, uint32_t size) +static int red_peer_receive(RedsStream *stream, uint8_t *buf, uint32_t size) { uint8_t *pos = buf; while (size) { int now; - if (peer->shutdown) { + if (stream->shutdown) { return -1; } - now = reds_stream_read(peer, pos, size); + now = reds_stream_read(stream, pos, size); if (now <= 0) { if (now == 0) { return -1; @@ -69,7 +69,7 @@ static int red_peer_receive(RedsStream *peer, uint8_t *buf, uint32_t size) // does many calls to red_peer_receive and through it cb_read, and thus avoids pointer // arithmetic for the case where a single cb_read could return multiple messages. But // this is suboptimal potentially. Profile and consider fixing. -static void red_peer_handle_incoming(RedsStream *peer, IncomingHandler *handler) +static void red_peer_handle_incoming(RedsStream *stream, IncomingHandler *handler) { int bytes_read; uint8_t *parsed; @@ -79,7 +79,7 @@ static void red_peer_handle_incoming(RedsStream *peer, IncomingHandler *handler) for (;;) { int ret_handle; if (handler->header_pos < sizeof(SpiceDataHeader)) { - bytes_read = red_peer_receive(peer, + bytes_read = red_peer_receive(stream, ((uint8_t *)&handler->header) + handler->header_pos, sizeof(SpiceDataHeader) - handler->header_pos); if (bytes_read == -1) { @@ -103,7 +103,7 @@ static void red_peer_handle_incoming(RedsStream *peer, IncomingHandler *handler) } } - bytes_read = red_peer_receive(peer, + bytes_read = red_peer_receive(stream, handler->msg + handler->msg_pos, handler->header.size - handler->msg_pos); if (bytes_read == -1) { @@ -150,10 +150,10 @@ static void red_peer_handle_incoming(RedsStream *peer, IncomingHandler *handler) void red_channel_receive(RedChannel *channel) { - red_peer_handle_incoming(channel->peer, &channel->incoming); + red_peer_handle_incoming(channel->stream, &channel->incoming); } -static void red_peer_handle_outgoing(RedsStream *peer, OutgoingHandler *handler) +static void red_peer_handle_outgoing(RedsStream *stream, OutgoingHandler *handler) { ssize_t n; @@ -167,7 +167,7 @@ static void red_peer_handle_outgoing(RedsStream *peer, OutgoingHandler *handler) for (;;) { handler->prepare(handler->opaque, handler->vec, &handler->vec_size, handler->pos); - n = reds_stream_writev(peer, handler->vec, handler->vec_size); + n = reds_stream_writev(stream, handler->vec, handler->vec_size); if (n == -1) { switch (errno) { case EAGAIN: @@ -236,7 +236,7 @@ static void red_channel_peer_on_out_block(void *opaque) RedChannel *channel = (RedChannel *)opaque; channel->send_data.blocked = TRUE; - channel->core->watch_update_mask(channel->peer->watch, + channel->core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ | SPICE_WATCH_EVENT_WRITE); } @@ -251,12 +251,12 @@ static void red_channel_peer_on_out_msg_done(void *opaque) } if (channel->send_data.blocked) { channel->send_data.blocked = FALSE; - channel->core->watch_update_mask(channel->peer->watch, + channel->core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ); } } -RedChannel *red_channel_create(int size, RedsStream *peer, +RedChannel *red_channel_create(int size, RedsStream *stream, SpiceCoreInterface *core, int migrate, int handle_acks, channel_configure_socket_proc config_socket, @@ -281,7 +281,7 @@ RedChannel *red_channel_create(int size, RedsStream *peer, channel->release_item = release_item; channel->hold_item = hold_item; - channel->peer = peer; + channel->stream = stream; channel->core = core; channel->ack_data.messages_window = ~0; // blocks send message (maybe use send_data.blocked + // block flags) @@ -315,7 +315,7 @@ RedChannel *red_channel_create(int size, RedsStream *peer, goto error; } - channel->peer->watch = channel->core->watch_add(channel->peer->socket, + channel->stream->watch = channel->core->watch_add(channel->stream->socket, SPICE_WATCH_EVENT_READ, red_channel_event, channel); @@ -324,7 +324,7 @@ RedChannel *red_channel_create(int size, RedsStream *peer, error: spice_marshaller_destroy(channel->send_data.marshaller); free(channel); - reds_stream_free(peer); + reds_stream_free(stream); return NULL; } @@ -338,7 +338,7 @@ int do_nothing_handle_message(RedChannel *red_channel, SpiceDataHeader *header, return TRUE; } -RedChannel *red_channel_create_parser(int size, RedsStream *peer, +RedChannel *red_channel_create_parser(int size, RedsStream *stream, SpiceCoreInterface *core, int migrate, int handle_acks, channel_configure_socket_proc config_socket, @@ -352,7 +352,7 @@ RedChannel *red_channel_create_parser(int size, RedsStream *peer, channel_on_incoming_error_proc incoming_error, channel_on_outgoing_error_proc outgoing_error) { - RedChannel *channel = red_channel_create(size, peer, + RedChannel *channel = red_channel_create(size, stream, core, migrate, handle_acks, config_socket, do_nothing_disconnect, do_nothing_handle_message, alloc_recv_buf, release_recv_buf, hold_item, send_item, release_item); @@ -375,7 +375,7 @@ void red_channel_destroy(RedChannel *channel) return; } red_channel_pipe_clear(channel); - reds_stream_free(channel->peer); + reds_stream_free(channel->stream); spice_marshaller_destroy(channel->send_data.marshaller); free(channel); } @@ -383,12 +383,12 @@ void red_channel_destroy(RedChannel *channel) void red_channel_shutdown(RedChannel *channel) { red_printf(""); - if (channel->peer && !channel->peer->shutdown) { - channel->core->watch_update_mask(channel->peer->watch, + if (channel->stream && !channel->stream->shutdown) { + channel->core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ); red_channel_pipe_clear(channel); - shutdown(channel->peer->socket, SHUT_RDWR); - channel->peer->shutdown = TRUE; + shutdown(channel->stream->socket, SHUT_RDWR); + channel->stream->shutdown = TRUE; } } @@ -471,7 +471,7 @@ void red_channel_init_send_data(RedChannel *channel, uint16_t msg_type, PipeItem void red_channel_send(RedChannel *channel) { - red_peer_handle_outgoing(channel->peer, &channel->outgoing); + red_peer_handle_outgoing(channel->stream, &channel->outgoing); } void red_channel_begin_send_message(RedChannel *channel) @@ -600,7 +600,7 @@ static inline PipeItem *red_channel_pipe_get(RedChannel *channel) int red_channel_is_connected(RedChannel *channel) { - return !!channel->peer; + return !!channel->stream; } void red_channel_pipe_clear(RedChannel *channel) diff --git a/server/red_channel.h b/server/red_channel.h index fd9ce37..a23a618 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -114,7 +114,7 @@ typedef void (*channel_on_incoming_error_proc)(RedChannel *channel); typedef void (*channel_on_outgoing_error_proc)(RedChannel *channel); struct RedChannel { - RedsStream *peer; + RedsStream *stream; SpiceCoreInterface *core; int migrate; int handle_acks; @@ -160,7 +160,7 @@ struct RedChannel { /* if one of the callbacks should cause disconnect, use red_channel_shutdown and don't explicitly destroy the channel */ -RedChannel *red_channel_create(int size, RedsStream *peer, +RedChannel *red_channel_create(int size, RedsStream *stream, SpiceCoreInterface *core, int migrate, int handle_acks, channel_configure_socket_proc config_socket, @@ -174,7 +174,7 @@ RedChannel *red_channel_create(int size, RedsStream *peer, /* alternative constructor, meant for marshaller based (inputs,main) channels, * will become default eventually */ -RedChannel *red_channel_create_parser(int size, RedsStream *peer, +RedChannel *red_channel_create_parser(int size, RedsStream *stream, SpiceCoreInterface *core, int migrate, int handle_acks, channel_configure_socket_proc config_socket, diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c index 3816e14..75e0670 100644 --- a/server/red_dispatcher.c +++ b/server/red_dispatcher.c @@ -71,7 +71,7 @@ extern spice_wan_compression_t zlib_glz_state; static RedDispatcher *dispatchers = NULL; -static void red_dispatcher_set_peer(Channel *channel, RedsStream *peer, int migration, +static void red_dispatcher_set_peer(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { @@ -81,7 +81,7 @@ static void red_dispatcher_set_peer(Channel *channel, RedsStream *peer, int migr dispatcher = (RedDispatcher *)channel->data; RedWorkerMessage message = RED_WORKER_MESSAGE_DISPLAY_CONNECT; write_message(dispatcher->channel, &message); - send_data(dispatcher->channel, &peer, sizeof(RedsStream *)); + send_data(dispatcher->channel, &stream, sizeof(RedsStream *)); send_data(dispatcher->channel, &migration, sizeof(int)); } @@ -101,7 +101,7 @@ static void red_dispatcher_migrate(Channel *channel) write_message(dispatcher->channel, &message); } -static void red_dispatcher_set_cursor_peer(Channel *channel, RedsStream *peer, +static void red_dispatcher_set_cursor_peer(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) @@ -110,7 +110,7 @@ static void red_dispatcher_set_cursor_peer(Channel *channel, RedsStream *peer, red_printf(""); RedWorkerMessage message = RED_WORKER_MESSAGE_CURSOR_CONNECT; write_message(dispatcher->channel, &message); - send_data(dispatcher->channel, &peer, sizeof(RedsStream *)); + send_data(dispatcher->channel, &stream, sizeof(RedsStream *)); send_data(dispatcher->channel, &migration, sizeof(int)); } diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c index 6ea58f0..fddcf2c 100644 --- a/server/red_tunnel_worker.c +++ b/server/red_tunnel_worker.c @@ -598,7 +598,7 @@ static void arm_timer(SlirpUsrNetworkInterface *usr_interface, UserTimer *timer, /* reds interface */ -static void handle_tunnel_channel_link(Channel *channel, RedsStream *peer, int migration, +static void handle_tunnel_channel_link(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps); static void handle_tunnel_channel_shutdown(struct Channel *channel); @@ -3347,19 +3347,19 @@ static int tunnel_channel_config_socket(RedChannel *channel) int flags; int delay_val; - if ((flags = fcntl(channel->peer->socket, F_GETFL)) == -1) { + if ((flags = fcntl(channel->stream->socket, F_GETFL)) == -1) { red_printf("accept failed, %s", strerror(errno)); // can't we just use red_error? return FALSE; } - if (fcntl(channel->peer->socket, F_SETFL, flags | O_NONBLOCK) == -1) { + if (fcntl(channel->stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { red_printf("accept failed, %s", strerror(errno)); return FALSE; } delay_val = 1; - if (setsockopt(channel->peer->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, + if (setsockopt(channel->stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); } @@ -3424,7 +3424,7 @@ static void tunnel_channel_hold_pipe_item(PipeItem *item) { } -static void handle_tunnel_channel_link(Channel *channel, RedsStream *peer, int migration, +static void handle_tunnel_channel_link(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { @@ -3435,7 +3435,7 @@ static void handle_tunnel_channel_link(Channel *channel, RedsStream *peer, int m } tunnel_channel = - (TunnelChannel *)red_channel_create(sizeof(*tunnel_channel), peer, worker->core_interface, + (TunnelChannel *)red_channel_create(sizeof(*tunnel_channel), stream, worker->core_interface, migration, TRUE, tunnel_channel_config_socket, tunnel_channel_disconnect, diff --git a/server/red_worker.c b/server/red_worker.c index 3332f10..21d2f6c 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -355,7 +355,7 @@ typedef int (*channel_handle_parsed_proc)(RedChannel *channel, uint32_t size, ui struct RedChannel { spice_parse_channel_func_t parser; - RedsStream *peer; + RedsStream *stream; int migrate; Ring pipe; @@ -7353,8 +7353,8 @@ static void red_send_data(RedChannel *channel) } vec_size = spice_marshaller_fill_iovec(channel->send_data.marshaller, vec, MAX_SEND_VEC, channel->send_data.pos); - ASSERT(channel->peer); - n = reds_stream_writev(channel->peer, vec, vec_size); + ASSERT(channel->stream); + n = reds_stream_writev(channel->stream, vec, vec_size); if (n == -1) { switch (errno) { case EAGAIN: @@ -8542,15 +8542,15 @@ void red_show_tree(RedWorker *worker) static inline int channel_is_connected(RedChannel *channel) { - return !!channel->peer; + return !!channel->stream; } static void red_disconnect_channel(RedChannel *channel) { channel_release_res(channel); red_pipe_clear(channel); - reds_stream_free(channel->peer); - channel->peer = NULL; + reds_stream_free(channel->stream); + channel->stream = NULL; channel->send_data.blocked = FALSE; channel->send_data.size = channel->send_data.pos = 0; spice_marshaller_reset(channel->send_data.marshaller); @@ -8563,7 +8563,7 @@ static void red_disconnect_display(RedChannel *channel) CommonChannel *common = SPICE_CONTAINEROF(channel, CommonChannel, base); RedWorker *worker; - if (!channel || !channel->peer) { + if (!channel || !channel->stream) { return; } worker = common->worker; @@ -8895,7 +8895,7 @@ static int display_channel_wait_for_init(DisplayChannel *display_channel) uint64_t end_time = red_now() + DISPLAY_CLIENT_TIMEOUT; for (;;) { red_receive((RedChannel *)display_channel); - if (!display_channel->common.base.peer) { + if (!display_channel->common.base.stream) { break; } if (display_channel->pixmap_cache && display_channel->glz_dict) { @@ -9277,8 +9277,8 @@ static void red_receive(RedChannel *channel) ssize_t n; n = channel->recive_data.end - channel->recive_data.now; ASSERT(n); - ASSERT(channel->peer); - n = reds_stream_read(channel->peer, channel->recive_data.now, n); + ASSERT(channel->stream); + n = reds_stream_read(channel->stream, channel->recive_data.now, n); if (n <= 0) { if (n == 0) { channel->disconnect(channel); @@ -9352,7 +9352,7 @@ static void free_common_channel_from_listener(EventListener *ctx) } static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_id, - RedsStream *peer, int migrate, + RedsStream *stream, int migrate, event_listener_action_proc handler, channel_disconnect_proc disconnect, channel_hold_pipe_item_proc hold_item, @@ -9365,18 +9365,18 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i int flags; int delay_val; - if ((flags = fcntl(peer->socket, F_GETFL)) == -1) { + if ((flags = fcntl(stream->socket, F_GETFL)) == -1) { red_printf("accept failed, %s", strerror(errno)); goto error1; } - if (fcntl(peer->socket, F_SETFL, flags | O_NONBLOCK) == -1) { + if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { red_printf("accept failed, %s", strerror(errno)); goto error1; } delay_val = IS_LOW_BANDWIDTH() ? 0 : 1; - if (setsockopt(peer->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { + if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); } @@ -9393,7 +9393,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i channel->hold_item = hold_item; channel->release_item = release_item; channel->handle_parsed = handle_parsed; - channel->peer = peer; + channel->stream = stream; common->worker = worker; channel->ack_data.messages_window = ~0; // blocks send message (maybe use send_data.blocked + // block flags) @@ -9408,7 +9408,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i event.events = EPOLLIN | EPOLLOUT | EPOLLET; event.data.ptr = &common->listener; - if (epoll_ctl(worker->epoll, EPOLL_CTL_ADD, peer->socket, &event) == -1) { + if (epoll_ctl(worker->epoll, EPOLL_CTL_ADD, stream->socket, &event) == -1) { red_printf("epoll_ctl failed, %s", strerror(errno)); goto error2; } @@ -9420,7 +9420,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i error2: free(channel); error1: - reds_stream_free(peer); + reds_stream_free(stream); return NULL; } @@ -9485,7 +9485,7 @@ static void display_channel_release_item(RedChannel *channel, PipeItem *item, in } } -static void handle_new_display_channel(RedWorker *worker, RedsStream *peer, int migrate) +static void handle_new_display_channel(RedWorker *worker, RedsStream *stream, int migrate) { DisplayChannel *display_channel; size_t stream_buf_size; @@ -9493,7 +9493,7 @@ static void handle_new_display_channel(RedWorker *worker, RedsStream *peer, int red_disconnect_display((RedChannel *)worker->display_channel); if (!(display_channel = (DisplayChannel *)__new_channel(worker, sizeof(*display_channel), - SPICE_CHANNEL_DISPLAY, peer, + SPICE_CHANNEL_DISPLAY, stream, migrate, handle_channel_events, red_disconnect_display, display_channel_hold_pipe_item, @@ -9567,7 +9567,7 @@ static void red_disconnect_cursor(RedChannel *channel) { CommonChannel *common; - if (!channel || !channel->peer) { + if (!channel || !channel->stream) { return; } common = SPICE_CONTAINEROF(channel, CommonChannel, base); @@ -9612,14 +9612,14 @@ static void cursor_channel_release_item(RedChannel *channel, PipeItem *item, int red_release_cursor(common->worker, SPICE_CONTAINEROF(item, CursorItem, pipe_data)); } -static void red_connect_cursor(RedWorker *worker, RedsStream *peer, int migrate) +static void red_connect_cursor(RedWorker *worker, RedsStream *stream, int migrate) { CursorChannel *channel; red_disconnect_cursor((RedChannel *)worker->cursor_channel); if (!(channel = (CursorChannel *)__new_channel(worker, sizeof(*channel), - SPICE_CHANNEL_CURSOR, peer, migrate, + SPICE_CHANNEL_CURSOR, stream, migrate, handle_channel_events, red_disconnect_cursor, cursor_channel_hold_pipe_item, @@ -10053,13 +10053,13 @@ static void handle_dev_input(EventListener *listener, uint32_t events) handle_dev_destroy_primary_surface(worker); break; case RED_WORKER_MESSAGE_DISPLAY_CONNECT: { - RedsStream *peer; + RedsStream *stream; int migrate; red_printf("connect"); - receive_data(worker->channel, &peer, sizeof(RedsStream *)); + receive_data(worker->channel, &stream, sizeof(RedsStream *)); receive_data(worker->channel, &migrate, sizeof(int)); - handle_new_display_channel(worker, peer, migrate); + handle_new_display_channel(worker, stream, migrate); break; } case RED_WORKER_MESSAGE_DISPLAY_DISCONNECT: @@ -10101,13 +10101,13 @@ static void handle_dev_input(EventListener *listener, uint32_t events) red_migrate_display(worker); break; case RED_WORKER_MESSAGE_CURSOR_CONNECT: { - RedsStream *peer; + RedsStream *stream; int migrate; red_printf("cursor connect"); - receive_data(worker->channel, &peer, sizeof(RedsStream *)); + receive_data(worker->channel, &stream, sizeof(RedsStream *)); receive_data(worker->channel, &migrate, sizeof(int)); - red_connect_cursor(worker, peer, migrate); + red_connect_cursor(worker, stream, migrate); break; } case RED_WORKER_MESSAGE_CURSOR_DISCONNECT: diff --git a/server/reds.c b/server/reds.c index c0af798..28daee7 100644 --- a/server/reds.c +++ b/server/reds.c @@ -224,7 +224,7 @@ typedef struct RedsState { static RedsState *reds = NULL; typedef struct AsyncRead { - RedsStream *peer; + RedsStream *stream; void *opaque; uint8_t *now; uint8_t *end; @@ -233,7 +233,7 @@ typedef struct AsyncRead { } AsyncRead; typedef struct RedLinkInfo { - RedsStream *peer; + RedsStream *stream; AsyncRead asyc_read; SpiceLinkHeader link_header; SpiceLinkMess *link_mess; @@ -297,11 +297,11 @@ static ChannelSecurityOptions *find_channel_security(int id) return now; } -static void reds_channel_event(RedsStream *peer, int event) +static void reds_stream_channel_event(RedsStream *s, int event) { if (core->base.minor_version < 3 || core->channel_event == NULL) return; - core->channel_event(event, &peer->info); + core->channel_event(event, &s->info); } static ssize_t stream_write_cb(RedsStream *s, const void *buf, size_t size) @@ -381,8 +381,8 @@ static void reds_stream_remove_watch(RedsStream* s) static void reds_link_free(RedLinkInfo *link) { - reds_stream_free(link->peer); - link->peer = NULL; + reds_stream_free(link->stream); + link->stream = NULL; free(link->link_mess); link->link_mess = NULL; @@ -1345,11 +1345,11 @@ void reds_on_main_receive_migrate_data(MainMigrateData *data, uint8_t *end) while (write_to_vdi_port() || read_from_vdi_port()); } -static int sync_write(RedsStream *peer, void *in_buf, size_t n) +static int sync_write(RedsStream *stream, void *in_buf, size_t n) { uint8_t *buf = (uint8_t *)in_buf; while (n) { - int now = reds_stream_write(peer, buf, n); + int now = reds_stream_write(stream, buf, n); if (now <= 0) { if (now == -1 && (errno == EINTR || errno == EAGAIN)) { continue; @@ -1406,12 +1406,12 @@ static int reds_send_link_ack(RedLinkInfo *link) BIO_get_mem_ptr(bio, &bmBuf); memcpy(ack.pub_key, bmBuf->data, sizeof(ack.pub_key)); - ret = sync_write(link->peer, &header, sizeof(header)) && sync_write(link->peer, &ack, + ret = sync_write(link->stream, &header, sizeof(header)) && sync_write(link->stream, &ack, sizeof(ack)); if (channel) { - ret = ret && sync_write(link->peer, channel->common_caps, + ret = ret && sync_write(link->stream, channel->common_caps, channel->num_common_caps * sizeof(uint32_t)) && - sync_write(link->peer, channel->caps, channel->num_caps * sizeof(uint32_t)); + sync_write(link->stream, channel->caps, channel->num_caps * sizeof(uint32_t)); } BIO_free(bio); return ret; @@ -1428,7 +1428,7 @@ static int reds_send_link_error(RedLinkInfo *link, uint32_t error) header.minor_version = SPICE_VERSION_MINOR; memset(&reply, 0, sizeof(reply)); reply.error = error; - return sync_write(link->peer, &header, sizeof(header)) && sync_write(link->peer, &reply, + return sync_write(link->stream, &header, sizeof(header)) && sync_write(link->stream, &reply, sizeof(reply)); } @@ -1437,27 +1437,27 @@ static void reds_show_new_channel(RedLinkInfo *link, int connection_id) red_printf("channel %d:%d, connected successfully, over %s link", link->link_mess->channel_type, link->link_mess->channel_id, - link->peer->ssl == NULL ? "Non Secure" : "Secure"); + link->stream->ssl == NULL ? "Non Secure" : "Secure"); /* add info + send event */ - if (link->peer->ssl) { - link->peer->info.flags |= SPICE_CHANNEL_EVENT_FLAG_TLS; + if (link->stream->ssl) { + link->stream->info.flags |= SPICE_CHANNEL_EVENT_FLAG_TLS; } - link->peer->info.connection_id = connection_id; - link->peer->info.type = link->link_mess->channel_type; - link->peer->info.id = link->link_mess->channel_id; - reds_channel_event(link->peer, SPICE_CHANNEL_EVENT_INITIALIZED); + link->stream->info.connection_id = connection_id; + link->stream->info.type = link->link_mess->channel_type; + link->stream->info.id = link->link_mess->channel_id; + reds_stream_channel_event(link->stream, SPICE_CHANNEL_EVENT_INITIALIZED); } static void reds_send_link_result(RedLinkInfo *link, uint32_t error) { - sync_write(link->peer, &error, sizeof(error)); + sync_write(link->stream, &error, sizeof(error)); } // TODO: now that main is a separate channel this should // actually be joined with reds_handle_other_links, ebcome reds_handle_link static void reds_handle_main_link(RedLinkInfo *link) { - RedsStream *peer; + RedsStream *stream; SpiceLinkMess *link_mess; uint32_t *caps; uint32_t connection_id; @@ -1489,14 +1489,14 @@ static void reds_handle_main_link(RedLinkInfo *link) reds->mig_wait_disconnect = FALSE; reds_show_new_channel(link, connection_id); - peer = link->peer; - reds_stream_remove_watch(peer); - link->peer = NULL; + stream = link->stream; + reds_stream_remove_watch(stream); + link->stream = NULL; link->link_mess = NULL; reds_link_free(link); caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset); reds->main_channel = main_channel_init(); - reds->main_channel->link(reds->main_channel, peer, reds->mig_target, link_mess->num_common_caps, + reds->main_channel->link(reds->main_channel, stream, reds->mig_target, link_mess->num_common_caps, link_mess->num_common_caps ? caps : NULL, link_mess->num_channel_caps, link_mess->num_channel_caps ? caps + link_mess->num_common_caps : NULL); free(link_mess); @@ -1560,7 +1560,7 @@ static void openssl_init(RedLinkInfo *link) static void reds_handle_other_links(RedLinkInfo *link) { Channel *channel; - RedsStream *peer; + RedsStream *stream; SpiceLinkMess *link_mess; uint32_t *caps; @@ -1581,18 +1581,18 @@ static void reds_handle_other_links(RedLinkInfo *link) reds_send_link_result(link, SPICE_LINK_ERR_OK); reds_show_new_channel(link, reds->link_id); - if (link_mess->channel_type == SPICE_CHANNEL_INPUTS && !link->peer->ssl) { + if (link_mess->channel_type == SPICE_CHANNEL_INPUTS && !link->stream->ssl) { char *mess = "keyboard channel is insecure"; const int mess_len = strlen(mess); main_channel_push_notify(reds->main_channel, (uint8_t*)mess, mess_len); } - peer = link->peer; - reds_stream_remove_watch(peer); - link->peer = NULL; + stream = link->stream; + reds_stream_remove_watch(stream); + link->stream = NULL; link->link_mess = NULL; reds_link_free(link); caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset); - channel->link(channel, peer, reds->mig_target, link_mess->num_common_caps, + channel->link(channel, stream, reds->mig_target, link_mess->num_common_caps, link_mess->num_common_caps ? caps : NULL, link_mess->num_channel_caps, link_mess->num_channel_caps ? caps + link_mess->num_common_caps : NULL); free(link_mess); @@ -1637,10 +1637,11 @@ static void reds_handle_ticket(void *opaque) static inline void async_read_clear_handlers(AsyncRead *obj) { - if (!obj->peer->watch) { + if (!obj->stream->watch) { return; } - reds_stream_remove_watch(obj->peer); + + reds_stream_remove_watch(obj->stream); } static void async_read_handler(int fd, int event, void *data) @@ -1651,13 +1652,13 @@ static void async_read_handler(int fd, int event, void *data) int n = obj->end - obj->now; ASSERT(n > 0); - n = reds_stream_read(obj->peer, obj->now, n); + n = reds_stream_read(obj->stream, obj->now, n); if (n <= 0) { if (n < 0) { switch (errno) { case EAGAIN: - if (!obj->peer->watch) { - obj->peer->watch = core->watch_add(obj->peer->socket, + if (!obj->stream->watch) { + obj->stream->watch = core->watch_add(obj->stream->socket, SPICE_WATCH_EVENT_READ, async_read_handler, obj); } @@ -1689,8 +1690,8 @@ static int reds_security_check(RedLinkInfo *link) { ChannelSecurityOptions *security_option = find_channel_security(link->link_mess->channel_type); uint32_t security = security_option ? security_option->options : default_channel_security; - return (link->peer->ssl && (security & SPICE_CHANNEL_SECURITY_SSL)) || - (!link->peer->ssl && (security & SPICE_CHANNEL_SECURITY_NONE)); + return (link->stream->ssl && (security & SPICE_CHANNEL_SECURITY_SSL)) || + (!link->stream->ssl && (security & SPICE_CHANNEL_SECURITY_NONE)); } static void reds_handle_read_link_done(void *opaque) @@ -1709,7 +1710,7 @@ static void reds_handle_read_link_done(void *opaque) } if (!reds_security_check(link)) { - if (link->peer->ssl) { + if (link->stream->ssl) { red_printf("spice channels %d should not be encrypted", link_mess->channel_type); reds_send_link_error(link, SPICE_LINK_ERR_NEED_UNSECURED); } else { @@ -1788,7 +1789,7 @@ static void reds_handle_new_link(RedLinkInfo *link) { AsyncRead *obj = &link->asyc_read; obj->opaque = link; - obj->peer = link->peer; + obj->stream = link->stream; obj->now = (uint8_t *)&link->link_header; obj->end = (uint8_t *)((SpiceLinkHeader *)&link->link_header + 1); obj->done = reds_handle_read_header_done; @@ -1801,28 +1802,28 @@ static void reds_handle_ssl_accept(int fd, int event, void *data) RedLinkInfo *link = (RedLinkInfo *)data; int return_code; - if ((return_code = SSL_accept(link->peer->ssl)) != 1) { - int ssl_error = SSL_get_error(link->peer->ssl, return_code); + if ((return_code = SSL_accept(link->stream->ssl)) != 1) { + int ssl_error = SSL_get_error(link->stream->ssl, return_code); if (ssl_error != SSL_ERROR_WANT_READ && ssl_error != SSL_ERROR_WANT_WRITE) { red_printf("SSL_accept failed, error=%d", ssl_error); reds_link_free(link); } else { if (ssl_error == SSL_ERROR_WANT_READ) { - core->watch_update_mask(link->peer->watch, SPICE_WATCH_EVENT_READ); + core->watch_update_mask(link->stream->watch, SPICE_WATCH_EVENT_READ); } else { - core->watch_update_mask(link->peer->watch, SPICE_WATCH_EVENT_WRITE); + core->watch_update_mask(link->stream->watch, SPICE_WATCH_EVENT_WRITE); } } return; } - reds_stream_remove_watch(link->peer); + reds_stream_remove_watch(link->stream); reds_handle_new_link(link); } static RedLinkInfo *__reds_accept_connection(int listen_socket) { RedLinkInfo *link; - RedsStream *peer; + RedsStream *stream; int delay_val = 1; int flags; int socket; @@ -1847,16 +1848,16 @@ static RedLinkInfo *__reds_accept_connection(int listen_socket) } link = spice_new0(RedLinkInfo, 1); - peer = spice_new0(RedsStream, 1); - link->peer = peer; - peer->socket = socket; + stream = spice_new0(RedsStream, 1); + link->stream = stream; + stream->socket = socket; /* gather info + send event */ - peer->info.llen = sizeof(peer->info.laddr); - peer->info.plen = sizeof(peer->info.paddr); - getsockname(peer->socket, (struct sockaddr*)(&peer->info.laddr), &peer->info.llen); - getpeername(peer->socket, (struct sockaddr*)(&peer->info.paddr), &peer->info.plen); - reds_channel_event(peer, SPICE_CHANNEL_EVENT_CONNECTED); + stream->info.llen = sizeof(stream->info.laddr); + stream->info.plen = sizeof(stream->info.paddr); + getsockname(stream->socket, (struct sockaddr*)(&stream->info.laddr), &stream->info.llen); + getpeername(stream->socket, (struct sockaddr*)(&stream->info.paddr), &stream->info.plen); + reds_stream_channel_event(stream, SPICE_CHANNEL_EVENT_CONNECTED); openssl_init(link); @@ -1871,15 +1872,15 @@ error: static RedLinkInfo *reds_accept_connection(int listen_socket) { RedLinkInfo *link; - RedsStream *peer; + RedsStream *stream; if (!(link = __reds_accept_connection(listen_socket))) { return NULL; } - peer = link->peer; - peer->read = stream_read_cb; - peer->write = stream_write_cb; - peer->writev = stream_writev_cb; + stream = link->stream; + stream->read = stream_read_cb; + stream->write = stream_write_cb; + stream->writev = stream_writev_cb; return link; } @@ -1897,47 +1898,47 @@ static void reds_accept_ssl_connection(int fd, int event, void *data) } // Handle SSL handshaking - if (!(sbio = BIO_new_socket(link->peer->socket, BIO_NOCLOSE))) { + if (!(sbio = BIO_new_socket(link->stream->socket, BIO_NOCLOSE))) { red_printf("could not allocate ssl bio socket"); goto error; } - link->peer->ssl = SSL_new(reds->ctx); - if (!link->peer->ssl) { + link->stream->ssl = SSL_new(reds->ctx); + if (!link->stream->ssl) { red_printf("could not allocate ssl context"); BIO_free(sbio); goto error; } - SSL_set_bio(link->peer->ssl, sbio, sbio); + SSL_set_bio(link->stream->ssl, sbio, sbio); - link->peer->write = stream_ssl_write_cb; - link->peer->read = stream_ssl_read_cb; - link->peer->writev = stream_ssl_writev_cb; + link->stream->write = stream_ssl_write_cb; + link->stream->read = stream_ssl_read_cb; + link->stream->writev = stream_ssl_writev_cb; - return_code = SSL_accept(link->peer->ssl); + return_code = SSL_accept(link->stream->ssl); if (return_code == 1) { reds_handle_new_link(link); return; } - ssl_error = SSL_get_error(link->peer->ssl, return_code); + ssl_error = SSL_get_error(link->stream->ssl, return_code); if (return_code == -1 && (ssl_error == SSL_ERROR_WANT_READ || ssl_error == SSL_ERROR_WANT_WRITE)) { int eventmask = ssl_error == SSL_ERROR_WANT_READ ? SPICE_WATCH_EVENT_READ : SPICE_WATCH_EVENT_WRITE; - link->peer->watch = core->watch_add(link->peer->socket, eventmask, + link->stream->watch = core->watch_add(link->stream->socket, eventmask, reds_handle_ssl_accept, link); return; } ERR_print_errors_fp(stderr); red_printf("SSL_accept failed, error=%d", ssl_error); - SSL_free(link->peer->ssl); + SSL_free(link->stream->ssl); error: - close(link->peer->socket); - free(link->peer); + close(link->stream->socket); + free(link->stream); BN_free(link->tiTicketing.bn); free(link); } @@ -3165,7 +3166,7 @@ void reds_stream_free(RedsStream *s) if (!s) return; - reds_channel_event(s, SPICE_CHANNEL_EVENT_DISCONNECTED); + reds_stream_channel_event(s, SPICE_CHANNEL_EVENT_DISCONNECTED); if (s->ssl) SSL_free(s->ssl); diff --git a/server/reds.h b/server/reds.h index 34e4082..3c810e0 100644 --- a/server/reds.h +++ b/server/reds.h @@ -55,7 +55,7 @@ typedef struct Channel { uint32_t *common_caps; int num_caps; uint32_t *caps; - void (*link)(struct Channel *, RedsStream *peer, int migration, int num_common_caps, + void (*link)(struct Channel *, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps); void (*shutdown)(struct Channel *); void (*migrate)(struct Channel *); diff --git a/server/smartcard.c b/server/smartcard.c index 23b3779..d890372 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -469,7 +469,7 @@ static void smartcard_channel_hold_pipe_item(PipeItem *item) { } -static void smartcard_link(Channel *channel, RedsStream *peer, +static void smartcard_link(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) @@ -479,7 +479,7 @@ static void smartcard_link(Channel *channel, RedsStream *peer, } g_smartcard_channel = (SmartCardChannel *)red_channel_create(sizeof(*g_smartcard_channel), - peer, core, + stream, core, migration, FALSE /* handle_acks */, smartcard_channel_config_socket, smartcard_channel_disconnect, diff --git a/server/snd_worker.c b/server/snd_worker.c index 80a0f78..f18f7c9 100644 --- a/server/snd_worker.c +++ b/server/snd_worker.c @@ -73,7 +73,7 @@ typedef void (*cleanup_channel_proc)(SndChannel *channel); typedef struct SndWorker SndWorker; struct SndChannel { - RedsStream *peer; + RedsStream *stream; SndWorker *worker; spice_parse_channel_func_t parser; @@ -186,9 +186,9 @@ static void snd_disconnect_channel(SndChannel *channel) channel->cleanup(channel); worker = channel->worker; worker->connection = NULL; - core->watch_remove(channel->peer->watch); - channel->peer->watch = NULL; - reds_stream_free(channel->peer); + core->watch_remove(channel->stream->watch); + channel->stream->watch = NULL; + reds_stream_free(channel->stream); spice_marshaller_destroy(channel->send_data.marshaller); free(channel); } @@ -236,19 +236,19 @@ static int snd_send_data(SndChannel *channel) if (channel->blocked) { channel->blocked = FALSE; - core->watch_update_mask(channel->peer->watch, SPICE_WATCH_EVENT_READ); + core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ); } break; } vec_size = spice_marshaller_fill_iovec(channel->send_data.marshaller, vec, MAX_SEND_VEC, channel->send_data.pos); - n = reds_stream_writev(channel->peer, vec, vec_size); + n = reds_stream_writev(channel->stream, vec, vec_size); if (n == -1) { switch (errno) { case EAGAIN: channel->blocked = TRUE; - core->watch_update_mask(channel->peer->watch, SPICE_WATCH_EVENT_READ | + core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ | SPICE_WATCH_EVENT_WRITE); return FALSE; case EINTR: @@ -390,7 +390,7 @@ static void snd_receive(void* data) ssize_t n; n = channel->recive_data.end - channel->recive_data.now; ASSERT(n); - n = reds_stream_read(channel->peer, channel->recive_data.now, n); + n = reds_stream_read(channel->stream, channel->recive_data.now, n); if (n <= 0) { if (n == 0) { snd_disconnect_channel(channel); @@ -736,7 +736,7 @@ static void snd_record_send(void* data) } static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_id, - RedsStream *peer, + RedsStream *stream, int migrate, send_messages_proc send_messages, handle_message_proc handle_message, on_message_done_proc on_message_done, @@ -748,28 +748,28 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i int priority; int tos; - if ((flags = fcntl(peer->socket, F_GETFL)) == -1) { + if ((flags = fcntl(stream->socket, F_GETFL)) == -1) { red_printf("accept failed, %s", strerror(errno)); goto error1; } priority = 6; - if (setsockopt(peer->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority, + if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); } tos = IPTOS_LOWDELAY; - if (setsockopt(peer->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) { + if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); } delay_val = IS_LOW_BANDWIDTH() ? 0 : 1; - if (setsockopt(peer->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { + if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); } - if (fcntl(peer->socket, F_SETFL, flags | O_NONBLOCK) == -1) { + if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { red_printf("accept failed, %s", strerror(errno)); goto error1; } @@ -777,16 +777,16 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i ASSERT(size >= sizeof(*channel)); channel = spice_malloc0(size); channel->parser = spice_get_client_channel_parser(channel_id, NULL); - channel->peer = peer; + channel->stream = stream; channel->worker = worker; channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf; channel->recive_data.now = channel->recive_data.buf; channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf); channel->send_data.marshaller = spice_marshaller_new(); - peer->watch = core->watch_add(peer->socket, SPICE_WATCH_EVENT_READ, + stream->watch = core->watch_add(stream->socket, SPICE_WATCH_EVENT_READ, snd_event, channel); - if (peer->watch == NULL) { + if (stream->watch == NULL) { red_printf("watch_add failed, %s", strerror(errno)); goto error2; } @@ -802,7 +802,7 @@ error2: free(channel); error1: - reds_stream_free(peer); + reds_stream_free(stream); return NULL; } @@ -933,7 +933,7 @@ static void snd_playback_cleanup(SndChannel *channel) celt051_mode_destroy(playback_channel->celt_mode); } -static void snd_set_playback_peer(Channel *channel, RedsStream *peer, int migration, +static void snd_set_playback_peer(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { @@ -961,7 +961,7 @@ static void snd_set_playback_peer(Channel *channel, RedsStream *peer, int migrat if (!(playback_channel = (PlaybackChannel *)__new_channel(worker, sizeof(*playback_channel), SPICE_CHANNEL_PLAYBACK, - peer, + stream, migration, snd_playback_send, snd_playback_handle_message, @@ -1099,7 +1099,7 @@ static void snd_record_cleanup(SndChannel *channel) celt051_mode_destroy(record_channel->celt_mode); } -static void snd_set_record_peer(Channel *channel, RedsStream *peer, int migration, +static void snd_set_record_peer(Channel *channel, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { @@ -1127,7 +1127,7 @@ static void snd_set_record_peer(Channel *channel, RedsStream *peer, int migratio if (!(record_channel = (RecordChannel *)__new_channel(worker, sizeof(*record_channel), SPICE_CHANNEL_RECORD, - peer, + stream, migration, snd_record_send, snd_record_handle_message, -- 1.7.4