[Spice-devel] [PATCH 09/13] server: pull out reds_handle_link(), for future reuse
Alon Levy
alevy at redhat.com
Thu Feb 24 11:39:14 PST 2011
On Tue, Feb 22, 2011 at 05:09:03PM +0100, Marc-André Lureau wrote:
> + a couple of indent, style change
ACK, but just a reminder (because I have to remind myself too) - our coding
style is 100 chars lines, not 80.
> ---
> server/reds.c | 25 ++++++++++++++++---------
> 1 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/server/reds.c b/server/reds.c
> index c07b840..3e2f927 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -1583,6 +1583,15 @@ static void reds_handle_other_links(RedLinkInfo *link)
> free(link_mess);
> }
>
> +static void reds_handle_link(RedLinkInfo *link)
> +{
> + if (link->link_mess->channel_type == SPICE_CHANNEL_MAIN) {
> + reds_handle_main_link(link);
> + } else {
> + reds_handle_other_links(link);
> + }
> +}
> +
> static void reds_handle_ticket(void *opaque)
> {
> RedLinkInfo *link = (RedLinkInfo *)opaque;
> @@ -1613,11 +1622,8 @@ static void reds_handle_ticket(void *opaque)
> return;
> }
> }
> - if (link->link_mess->channel_type == SPICE_CHANNEL_MAIN) {
> - reds_handle_main_link(link);
> - } else {
> - reds_handle_other_links(link);
> - }
> +
> + reds_handle_link(link);
> }
>
> static inline void async_read_clear_handlers(AsyncRead *obj)
> @@ -1687,8 +1693,8 @@ static void reds_handle_read_link_done(void *opaque)
> uint32_t num_caps = link_mess->num_common_caps + link_mess->num_channel_caps;
>
> if (num_caps && (num_caps * sizeof(uint32_t) + link_mess->caps_offset >
> - link->link_header.size ||
> - link_mess->caps_offset < sizeof(*link_mess))) {
> + link->link_header.size ||
> + link_mess->caps_offset < sizeof(*link_mess))) {
> reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
> reds_link_free(link);
> return;
> @@ -1863,6 +1869,7 @@ static RedLinkInfo *reds_accept_connection(int listen_socket)
> if (!(link = __reds_accept_connection(listen_socket))) {
> return NULL;
> }
> +
> stream = link->stream;
> stream->read = stream_read_cb;
> stream->write = stream_write_cb;
> @@ -1958,7 +1965,7 @@ static int reds_init_socket(const char *addr, int portnr, int family)
> snprintf(port, sizeof(port), "%d", portnr);
> rc = getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
> if (rc != 0) {
> - red_error("getaddrinfo(%s,%s): %s\n", addr, port,
> + red_error("getaddrinfo(%s,%s): %s", addr, port,
> gai_strerror(rc));
> }
>
> @@ -1984,7 +1991,7 @@ static int reds_init_socket(const char *addr, int portnr, int family)
> }
> close(slisten);
> }
> - red_printf("%s: binding socket to %s:%d failed\n", __FUNCTION__,
> + red_printf("%s: binding socket to %s:%d failed", __FUNCTION__,
> addr, portnr);
> freeaddrinfo(res);
> return -1;
> --
> 1.7.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list