diff options
author | Dan McGee <dpmcgee@gmail.com> | 2012-02-16 23:30:11 -0600 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2012-02-21 10:20:46 +0200 |
commit | 143a1df24e83e9c1e173c16aeb76d61ffdce9598 (patch) | |
tree | 263b215626c7a566a028875a4cfb8547dc941e0f /server/red_channel.c | |
parent | dfbac622bf9cbff7b4bdcabe78299621821ca61e (diff) |
red_worker: reimplement event loop using poll()
This removes the epoll dependency we had in red_worker, which was the
last Linux-specific call we were using in the entire Spice server. Given
we never have more than 10 file descriptors involved, there is little
performance gain had here by using epoll() over poll().
The biggest change is introduction of a new pre_disconnect callback;
this is because poll, unlike epoll, cannot automatically remove file
descriptors as they are closed from the pollfd set. This cannot be done
in the existing on_disconnect callback; that is too late as the stream
has already been closed and the file descriptor lost. The on_disconnect
callback can not be moved before the close and other operations easily
because of some behavior that relies on client_num being set to a
certain value.
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Diffstat (limited to 'server/red_channel.c')
-rw-r--r-- | server/red_channel.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/red_channel.c b/server/red_channel.c index 59e6af6d..5b8027cb 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -1191,6 +1191,9 @@ void red_channel_client_disconnect(RedChannelClient *rcc) return; } red_channel_client_pipe_clear(rcc); + if (rcc->channel->channel_cbs.pre_disconnect) { + rcc->channel->channel_cbs.pre_disconnect(rcc); + } reds_stream_free(rcc->stream); rcc->stream = NULL; red_channel_remove_client(rcc); |