diff options
author | Alon Levy <alevy@redhat.com> | 2010-11-10 09:28:39 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-03-02 17:27:52 +0200 |
commit | a05628bf061f5c0bcbd1221f8a990487210060de (patch) | |
tree | 3c13fe0ca151e5420f8260d390a2b1996aac4afb /server | |
parent | 6b862596460802aff0604f16bb3e77c524512e84 (diff) | |
download | spice-a05628bf061f5c0bcbd1221f8a990487210060de.tar.gz spice-a05628bf061f5c0bcbd1221f8a990487210060de.tar.xz spice-a05628bf061f5c0bcbd1221f8a990487210060de.zip |
server/red_channel (all): add red_channel_get_stream
use in config_socket, this makes the stream internal to the RedChannel
implementation that will change later for multiple client support.
Diffstat (limited to 'server')
-rw-r--r-- | server/inputs_channel.c | 7 | ||||
-rw-r--r-- | server/red_channel.c | 6 | ||||
-rw-r--r-- | server/red_channel.h | 4 | ||||
-rw-r--r-- | server/red_tunnel_worker.c | 7 | ||||
-rw-r--r-- | server/red_worker.c | 2 |
5 files changed, 19 insertions, 7 deletions
diff --git a/server/inputs_channel.c b/server/inputs_channel.c index 8140c04e..5e2681ad 100644 --- a/server/inputs_channel.c +++ b/server/inputs_channel.c @@ -491,15 +491,16 @@ static int inputs_channel_config_socket(RedChannel *channel) { int flags; int delay_val = 1; + RedsStream *stream = red_channel_get_stream(channel); - if (setsockopt(channel->stream->socket, IPPROTO_TCP, TCP_NODELAY, + if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); return FALSE; } - if ((flags = fcntl(channel->stream->socket, F_GETFL)) == -1 || - fcntl(channel->stream->socket, F_SETFL, flags | O_ASYNC) == -1) { + if ((flags = fcntl(stream->socket, F_GETFL)) == -1 || + fcntl(stream->socket, F_SETFL, flags | O_ASYNC) == -1) { red_printf("fcntl failed, %s", strerror(errno)); return FALSE; } diff --git a/server/red_channel.c b/server/red_channel.c index 5749dc35..f8944c01 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -706,7 +706,13 @@ void red_channel_ack_set_client_window(RedChannel *channel, int client_window) channel->ack_data.client_window = client_window; } +/* accessors for RedChannel */ SpiceMarshaller *red_channel_get_marshaller(RedChannel *channel) { return channel->send_data.marshaller; } + +RedsStream *red_channel_get_stream(RedChannel *channel) +{ + return channel->stream; +} diff --git a/server/red_channel.h b/server/red_channel.h index 1841de47..f991f2d4 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -272,6 +272,10 @@ void red_channel_pipe_clear(RedChannel *channel); // handle_channel_events - this is the only one that was used before, and was in red_channel.c void red_channel_receive(RedChannel *channel); void red_channel_send(RedChannel *channel); + +/* accessors for RedChannel */ +/* Note: the valid times to call red_channel_get_marshaller are just during send_item callback. */ SpiceMarshaller *red_channel_get_marshaller(RedChannel *channel); +RedsStream *red_channel_get_stream(RedChannel *channel); #endif diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c index 0366290e..c990bd17 100644 --- a/server/red_tunnel_worker.c +++ b/server/red_tunnel_worker.c @@ -3335,20 +3335,21 @@ static int tunnel_channel_config_socket(RedChannel *channel) { int flags; int delay_val; + RedsStream *stream = red_channel_get_stream(channel); - if ((flags = fcntl(channel->stream->socket, F_GETFL)) == -1) { + if ((flags = fcntl(stream->socket, F_GETFL)) == -1) { red_printf("accept failed, %s", strerror(errno)); // can't we just use red_error? return FALSE; } - if (fcntl(channel->stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { + if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { red_printf("accept failed, %s", strerror(errno)); return FALSE; } delay_val = 1; - if (setsockopt(channel->stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, + if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { red_printf("setsockopt failed, %s", strerror(errno)); } diff --git a/server/red_worker.c b/server/red_worker.c index dd89e3fa..b8e4825b 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -9026,7 +9026,7 @@ int common_channel_config_socket(RedChannel *channel) { int flags; int delay_val; - RedsStream *stream = channel->stream; + RedsStream *stream = red_channel_get_stream(channel); if ((flags = fcntl(stream->socket, F_GETFL)) == -1) { red_printf("accept failed, %s", strerror(errno)); |