diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-05-07 14:39:12 -0400 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2013-05-08 11:18:44 -0400 |
commit | dbb99a6517bb7a1d059d7962ddba5ae5524abee3 (patch) | |
tree | 44cf4c4da0f4b897d02d63ca20cc9cbdcc94f24a | |
parent | f50827e5274cecbfca8cd5a4995215087d8368fc (diff) | |
download | spice-dbb99a6517bb7a1d059d7962ddba5ae5524abee3.tar.gz spice-dbb99a6517bb7a1d059d7962ddba5ae5524abee3.tar.xz spice-dbb99a6517bb7a1d059d7962ddba5ae5524abee3.zip |
red_channel: add spice_channel_client_error
spice_channel_client_error prints warning and shutdowns the
channel_client that hit the error.
This macro is useful for errors that are specific for one session
and that are unrecoverable only with respect to this session.
Prefer disconnecting a client over aborting when possible.
-rw-r--r-- | server/red_channel.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/red_channel.h b/server/red_channel.h index f7705100..ba299b66 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -328,6 +328,17 @@ struct RedChannel { #endif }; +/* + * When an error occurs over a channel, we treat it as a warning + * for spice-server and shutdown the channel. + */ +#define spice_channel_client_error(rcc, format, ...) \ + do { \ + spice_warning("rcc %p type %u id %u: " format, rcc, \ + rcc->channel->type, rcc->channel->id, ## __VA_ARGS__); \ + red_channel_client_shutdown(rcc); \ + } while (0) + /* 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, |