mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-08 12:24:55 +00:00
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.
This commit is contained in:
parent
6b86259646
commit
a05628bf06
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user