[Spice-devel] [PATCH spice-server] Remove reds_stream_set_info_flag

Frediano Ziglio fziglio at redhat.com
Tue Feb 28 10:09:56 UTC 2017


Encapsulate into reds_stream_set_channel.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds-stream.c | 11 +++--------
 server/reds-stream.h |  1 -
 server/reds.c        |  3 ---
 3 files changed, 3 insertions(+), 12 deletions(-)

This is a first patch attempting to remove spice
dependencies from RedsStream.
I think it's possible and I think a so low level
code should not depends on spice stuff.

diff --git a/server/reds-stream.c b/server/reds-stream.c
index d0dadb9..cb88fc9 100644
--- a/server/reds-stream.c
+++ b/server/reds-stream.c
@@ -380,6 +380,9 @@ void reds_stream_set_channel(RedsStream *stream, int connection_id,
     stream->priv->info->connection_id = connection_id;
     stream->priv->info->type = channel_type;
     stream->priv->info->id   = channel_id;
+    if (reds_stream_is_ssl(stream)) {
+        stream->priv->info->flags |= SPICE_CHANNEL_EVENT_FLAG_TLS;
+    }
 }
 
 RedsStream *reds_stream_new(RedsState *reds, int socket)
@@ -404,14 +407,6 @@ bool reds_stream_is_ssl(RedsStream *stream)
     return (stream->priv->ssl != NULL);
 }
 
-void reds_stream_set_info_flag(RedsStream *stream, unsigned int flag)
-{
-    g_return_if_fail((flag == SPICE_CHANNEL_EVENT_FLAG_TLS)
-                     || (flag == SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT));
-
-    stream->priv->info->flags |= flag;
-}
-
 void reds_stream_disable_writev(RedsStream *stream)
 {
     stream->priv->writev = NULL;
diff --git a/server/reds-stream.h b/server/reds-stream.h
index a8d1736..3a4aa25 100644
--- a/server/reds-stream.h
+++ b/server/reds-stream.h
@@ -71,7 +71,6 @@ RedsStream *reds_stream_new(RedsState *reds, int socket);
 bool reds_stream_is_ssl(RedsStream *stream);
 RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream);
 int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx);
-void reds_stream_set_info_flag(RedsStream *stream, unsigned int flag);
 int reds_stream_get_family(const RedsStream *stream);
 int reds_stream_is_plain_unix(const RedsStream *stream);
 int reds_stream_send_msgfd(RedsStream *stream, int fd);
diff --git a/server/reds.c b/server/reds.c
index 39a7a31..966a271 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1580,9 +1580,6 @@ static void reds_info_new_channel(RedLinkInfo *link, int connection_id)
                link->link_mess->channel_id,
                reds_stream_is_ssl(link->stream) ? "Secure" : "Non Secure");
     /* add info + send event */
-    if (reds_stream_is_ssl(link->stream)) {
-        reds_stream_set_info_flag(link->stream, SPICE_CHANNEL_EVENT_FLAG_TLS);
-    }
     reds_stream_set_channel(link->stream, connection_id,
                             link->link_mess->channel_type,
                             link->link_mess->channel_id);
-- 
2.9.3



More information about the Spice-devel mailing list