[Spice-devel] [PATCH 15/17] Introduce reds_stream_set_info_flag()
Christophe Fergeau
cfergeau at redhat.com
Tue Jan 7 03:14:41 PST 2014
---
server/reds.c | 2 +-
server/reds_stream.c | 10 ++++++++++
server/reds_stream.h | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/server/reds.c b/server/reds.c
index f35f989..a993f2c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1414,7 +1414,7 @@ static void reds_info_new_channel(RedLinkInfo *link, int connection_id)
reds_stream_is_ssl(link->stream) ? "Secure" : "Non Secure");
/* add info + send event */
if (reds_stream_is_ssl(link->stream)) {
- link->stream->info->flags |= SPICE_CHANNEL_EVENT_FLAG_TLS;
+ reds_stream_set_info_flag(link->stream, SPICE_CHANNEL_EVENT_FLAG_TLS);
}
link->stream->info->connection_id = connection_id;
link->stream->info->type = link->link_mess->channel_type;
diff --git a/server/reds_stream.c b/server/reds_stream.c
index 837d2cb..d2c05d9 100644
--- a/server/reds_stream.c
+++ b/server/reds_stream.c
@@ -29,6 +29,8 @@
#include <unistd.h>
#include <sys/socket.h>
+#include <glib.h>
+
#include <openssl/err.h>
extern SpiceCoreInterface *core;
@@ -303,6 +305,14 @@ 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->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 e2a6d61..add9b2e 100644
--- a/server/reds_stream.h
+++ b/server/reds_stream.h
@@ -85,6 +85,7 @@ RedsStream *reds_stream_new(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);
typedef enum {
REDS_SASL_ERROR_OK,
--
1.8.4.2
More information about the Spice-devel
mailing list