diff options
author | Alon Levy <alevy@redhat.com> | 2010-11-07 12:42:38 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2010-11-07 12:42:38 +0200 |
commit | fcff38b9f974277964a44260b7295979dfa24ef0 (patch) | |
tree | dc64e11eed9f489f9d214b94e3af4a9e4a6e532d | |
parent | 0a1c9019b019d8b553d779efe72d9b6140456180 (diff) | |
download | spice-fcff38b9f974277964a44260b7295979dfa24ef0.tar.gz spice-fcff38b9f974277964a44260b7295979dfa24ef0.tar.xz spice-fcff38b9f974277964a44260b7295979dfa24ef0.zip |
server/red_channel: add public red_channel_default_peer_on_error for later use in red_worker
-rw-r--r-- | server/red_channel.c | 8 | ||||
-rw-r--r-- | server/red_channel.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/server/red_channel.c b/server/red_channel.c index 6f4d588b..3ec693d3 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -180,10 +180,8 @@ static void red_peer_handle_outgoing(RedsStreamContext *peer, OutgoingHandler *h } } -static void red_channel_peer_on_error(void *opaque) +void red_channel_default_peer_on_error(RedChannel *channel) { - RedChannel *channel = (RedChannel *)opaque; - channel->disconnect(channel); } @@ -284,7 +282,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer, channel->incoming.alloc_msg_buf = (alloc_msg_recv_buf_proc)alloc_recv_buf; channel->incoming.release_msg_buf = (release_msg_recv_buf_proc)release_recv_buf; channel->incoming.handle_message = (handle_message_proc)handle_message; - channel->incoming.on_error = red_channel_peer_on_error; + channel->incoming.on_error = (on_incoming_error_proc)red_channel_default_peer_on_error; channel->outgoing.opaque = channel; channel->outgoing.pos = 0; @@ -294,7 +292,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer, channel->outgoing.get_msg_size = red_channel_peer_get_out_msg_size; channel->outgoing.prepare = red_channel_peer_prepare_out_msg; channel->outgoing.on_block = red_channel_peer_on_out_block; - channel->outgoing.on_error = red_channel_peer_on_error; + channel->outgoing.on_error = (on_outgoing_error_proc)red_channel_default_peer_on_error; channel->outgoing.on_msg_done = red_channel_peer_on_out_msg_done; channel->shut = 0; // came here from inputs, perhaps can be removed? XXX diff --git a/server/red_channel.h b/server/red_channel.h index 3e85f9f1..db410fe0 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -203,6 +203,8 @@ void red_channel_init_outgoing_messages_window(RedChannel *channel); int red_channel_handle_message(RedChannel *channel, uint32_t size, uint16_t type, void *message); +/* default error handler that disconnects channel */ +void red_channel_default_peer_on_error(RedChannel *channel); /* when preparing send_data: should call reset, then init and then add_buf per buffer that is being sent */ |