summaryrefslogtreecommitdiffstats
path: root/server/snd_worker.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-02-09 21:44:45 +0100
committerAlon Levy <alevy@redhat.com>2011-07-21 15:09:26 +0300
commit26ded5e3950b2c9c552a3fc89647203e63b02411 (patch)
treefed7a072edabc3072fdef68a2f7379e1bc0dfeab /server/snd_worker.c
parent5f27f8f522121556c515e4c37227f3853c3c7472 (diff)
downloadspice-26ded5e3950b2c9c552a3fc89647203e63b02411.tar.gz
spice-26ded5e3950b2c9c552a3fc89647203e63b02411.tar.xz
spice-26ded5e3950b2c9c552a3fc89647203e63b02411.zip
server: rename s/peer/stream
This is stylish change again. We are talking about a RedStream object, so let's just name the variable "stream" everywhere, to avoid confusion with a non existent RedPeer object. https://bugs.freedesktop.org/show_bug.cgi?id=34795
Diffstat (limited to 'server/snd_worker.c')
-rw-r--r--server/snd_worker.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 80a0f788..f18f7c90 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -73,7 +73,7 @@ typedef void (*cleanup_channel_proc)(SndChannel *channel);
typedef struct SndWorker SndWorker;
struct SndChannel {
- RedsStream *peer;
+ RedsStream *stream;
SndWorker *worker;
spice_parse_channel_func_t parser;
@@ -186,9 +186,9 @@ static void snd_disconnect_channel(SndChannel *channel)
channel->cleanup(channel);
worker = channel->worker;
worker->connection = NULL;
- core->watch_remove(channel->peer->watch);
- channel->peer->watch = NULL;
- reds_stream_free(channel->peer);
+ core->watch_remove(channel->stream->watch);
+ channel->stream->watch = NULL;
+ reds_stream_free(channel->stream);
spice_marshaller_destroy(channel->send_data.marshaller);
free(channel);
}
@@ -236,19 +236,19 @@ static int snd_send_data(SndChannel *channel)
if (channel->blocked) {
channel->blocked = FALSE;
- core->watch_update_mask(channel->peer->watch, SPICE_WATCH_EVENT_READ);
+ core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ);
}
break;
}
vec_size = spice_marshaller_fill_iovec(channel->send_data.marshaller,
vec, MAX_SEND_VEC, channel->send_data.pos);
- n = reds_stream_writev(channel->peer, vec, vec_size);
+ n = reds_stream_writev(channel->stream, vec, vec_size);
if (n == -1) {
switch (errno) {
case EAGAIN:
channel->blocked = TRUE;
- core->watch_update_mask(channel->peer->watch, SPICE_WATCH_EVENT_READ |
+ core->watch_update_mask(channel->stream->watch, SPICE_WATCH_EVENT_READ |
SPICE_WATCH_EVENT_WRITE);
return FALSE;
case EINTR:
@@ -390,7 +390,7 @@ static void snd_receive(void* data)
ssize_t n;
n = channel->recive_data.end - channel->recive_data.now;
ASSERT(n);
- n = reds_stream_read(channel->peer, channel->recive_data.now, n);
+ n = reds_stream_read(channel->stream, channel->recive_data.now, n);
if (n <= 0) {
if (n == 0) {
snd_disconnect_channel(channel);
@@ -736,7 +736,7 @@ static void snd_record_send(void* data)
}
static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_id,
- RedsStream *peer,
+ RedsStream *stream,
int migrate, send_messages_proc send_messages,
handle_message_proc handle_message,
on_message_done_proc on_message_done,
@@ -748,28 +748,28 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
int priority;
int tos;
- if ((flags = fcntl(peer->socket, F_GETFL)) == -1) {
+ if ((flags = fcntl(stream->socket, F_GETFL)) == -1) {
red_printf("accept failed, %s", strerror(errno));
goto error1;
}
priority = 6;
- if (setsockopt(peer->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority,
+ if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority,
sizeof(priority)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
}
tos = IPTOS_LOWDELAY;
- if (setsockopt(peer->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) {
+ if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
}
delay_val = IS_LOW_BANDWIDTH() ? 0 : 1;
- if (setsockopt(peer->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) {
+ if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
}
- if (fcntl(peer->socket, F_SETFL, flags | O_NONBLOCK) == -1) {
+ if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) {
red_printf("accept failed, %s", strerror(errno));
goto error1;
}
@@ -777,16 +777,16 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
ASSERT(size >= sizeof(*channel));
channel = spice_malloc0(size);
channel->parser = spice_get_client_channel_parser(channel_id, NULL);
- channel->peer = peer;
+ channel->stream = stream;
channel->worker = worker;
channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
channel->recive_data.now = channel->recive_data.buf;
channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf);
channel->send_data.marshaller = spice_marshaller_new();
- peer->watch = core->watch_add(peer->socket, SPICE_WATCH_EVENT_READ,
+ stream->watch = core->watch_add(stream->socket, SPICE_WATCH_EVENT_READ,
snd_event, channel);
- if (peer->watch == NULL) {
+ if (stream->watch == NULL) {
red_printf("watch_add failed, %s", strerror(errno));
goto error2;
}
@@ -802,7 +802,7 @@ error2:
free(channel);
error1:
- reds_stream_free(peer);
+ reds_stream_free(stream);
return NULL;
}
@@ -933,7 +933,7 @@ static void snd_playback_cleanup(SndChannel *channel)
celt051_mode_destroy(playback_channel->celt_mode);
}
-static void snd_set_playback_peer(Channel *channel, RedsStream *peer, int migration,
+static void snd_set_playback_peer(Channel *channel, RedsStream *stream, int migration,
int num_common_caps, uint32_t *common_caps, int num_caps,
uint32_t *caps)
{
@@ -961,7 +961,7 @@ static void snd_set_playback_peer(Channel *channel, RedsStream *peer, int migrat
if (!(playback_channel = (PlaybackChannel *)__new_channel(worker,
sizeof(*playback_channel),
SPICE_CHANNEL_PLAYBACK,
- peer,
+ stream,
migration,
snd_playback_send,
snd_playback_handle_message,
@@ -1099,7 +1099,7 @@ static void snd_record_cleanup(SndChannel *channel)
celt051_mode_destroy(record_channel->celt_mode);
}
-static void snd_set_record_peer(Channel *channel, RedsStream *peer, int migration,
+static void snd_set_record_peer(Channel *channel, RedsStream *stream, int migration,
int num_common_caps, uint32_t *common_caps, int num_caps,
uint32_t *caps)
{
@@ -1127,7 +1127,7 @@ static void snd_set_record_peer(Channel *channel, RedsStream *peer, int migratio
if (!(record_channel = (RecordChannel *)__new_channel(worker,
sizeof(*record_channel),
SPICE_CHANNEL_RECORD,
- peer,
+ stream,
migration,
snd_record_send,
snd_record_handle_message,