[Spice-commits] 2 commits - server/inputs_channel.c server/reds.c server/spice-server.syms server/spice.h server/spicevmc.c
Hans de Goede
jwrdegoede at kemper.freedesktop.org
Mon Mar 12 04:33:33 PDT 2012
server/inputs_channel.c | 2 +-
server/reds.c | 21 +++++++++++++++++++++
server/spice-server.syms | 1 +
server/spice.h | 1 +
server/spicevmc.c | 2 +-
5 files changed, 25 insertions(+), 2 deletions(-)
New commits:
commit 198ffb92d482fd01af8a774788afa3931721b714
Author: Nahum Shalman <nshalman at elys.com>
Date: Mon Mar 12 12:33:20 2012 +0100
server: listen on a pre-opened file descriptor
Allow applications to pre-open a file descriptor and have spice listen
on it.
Thanks to Daniel Berrange for his comments
diff --git a/server/reds.c b/server/reds.c
index 5fc03ea..dc009f4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -94,6 +94,7 @@ static SpiceMigrateInstance *migration_interface = NULL;
static int spice_port = -1;
static int spice_secure_port = -1;
+static int spice_listen_socket_fd = -1;
static char spice_addr[256];
static int spice_family = PF_UNSPEC;
static char *default_renderer = "sw";
@@ -2995,6 +2996,19 @@ static int reds_init_net(void)
red_error("set fd handle failed");
}
}
+
+ if (spice_listen_socket_fd != -1 ) {
+ reds->listen_socket = spice_listen_socket_fd;
+ if (-1 == reds->listen_socket) {
+ return -1;
+ }
+ reds->listen_watch = core->watch_add(reds->listen_socket,
+ SPICE_WATCH_EVENT_READ,
+ reds_accept, NULL);
+ if (reds->listen_watch == NULL) {
+ red_error("set fd handle failed");
+ }
+ }
return 0;
}
@@ -3787,6 +3801,13 @@ SPICE_GNUC_VISIBLE void spice_server_set_addr(SpiceServer *s, const char *addr,
}
}
+SPICE_GNUC_VISIBLE int spice_server_set_listen_socket_fd(SpiceServer *s, int listen_fd)
+{
+ ASSERT(reds == s);
+ spice_listen_socket_fd = listen_fd;
+ return 0;
+}
+
SPICE_GNUC_VISIBLE int spice_server_set_noauth(SpiceServer *s)
{
ASSERT(reds == s);
diff --git a/server/spice-server.syms b/server/spice-server.syms
index 272548e..4b842a3 100644
--- a/server/spice-server.syms
+++ b/server/spice-server.syms
@@ -106,4 +106,5 @@ SPICE_SERVER_0.10.2 {
global:
spice_server_set_name;
spice_server_set_uuid;
+ spice_server_set_listen_socket_fd;
} SPICE_SERVER_0.10.1;
diff --git a/server/spice.h b/server/spice.h
index 151b3db..8dd1c3d 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -421,6 +421,7 @@ int spice_server_set_compat_version(SpiceServer *s,
spice_compat_version_t version);
int spice_server_set_port(SpiceServer *s, int port);
void spice_server_set_addr(SpiceServer *s, const char *addr, int flags);
+int spice_server_set_listen_socket_fd(SpiceServer *s, int listen_fd);
int spice_server_set_noauth(SpiceServer *s);
int spice_server_set_sasl(SpiceServer *s, int enabled);
int spice_server_set_sasl_appname(SpiceServer *s, const char *appname);
commit 20c7323c9efb22c1aae37557814f21cf58c2a322
Author: Nahum Shalman <nshalman at elys.com>
Date: Mon Mar 12 12:32:58 2012 +0100
server: don't fail on ENOPROTOOPT from setsockopt
If we allow listening on arbitrary sockets like unix sockets,
we can get ENOPROTOOPT errors from setsockopt calls that set TCP
specific options. This should be allowed to happen.
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 932ead7..4224761 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -470,7 +470,7 @@ static int inputs_channel_config_socket(RedChannelClient *rcc)
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
&delay_val, sizeof(delay_val)) == -1) {
- if (errno != ENOTSUP) {
+ if (errno != ENOTSUP && errno != ENOPROTOOPT) {
red_printf("setsockopt failed, %s", strerror(errno));
return FALSE;
}
diff --git a/server/spicevmc.c b/server/spicevmc.c
index ea9271c..2f1b8f7 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -92,7 +92,7 @@ static int spicevmc_red_channel_client_config_socket(RedChannelClient *rcc)
if (rcc->channel->type == SPICE_CHANNEL_USBREDIR) {
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
&delay_val, sizeof(delay_val)) != 0) {
- if (errno != ENOTSUP) {
+ if (errno != ENOTSUP && errno != ENOPROTOOPT) {
red_printf("setsockopt failed, %s", strerror(errno));
return FALSE;
}
More information about the Spice-commits
mailing list