spice/server
Frediano Ziglio 5c460de1a3 worker: push data when clients can receive them
During every iteration of the main worker loop, outgoing data was pushed to
the client. However, there was no guarantee that the loop would be woken up
in every situation. So there were some conditions where the loop would stop
iterating until a new event was sent.

Currently, the events that can wake up the main worker loop include:
 - data from dispatcher (including wakeups from the guest)
 - data from clients
 - timeouts on a stream
 - other timeouts
 - polling

This patch adds a new wakeup event: when we have items that are queued to
be sent to a client, we set up a watch event for writing data to the
client. If no items are waiting to be sent, this watch will be disabled.
This allows us to remove the explicit push from the main worker loop.

This has some advantages:
 - it could lower latency as we don't have to wait for a polling timeout.
   From my experiments using a tight loop (so not really the ideal
   condition to see the improvements) the total time was reduced by 2-3%)
 - helps reduce the possibility of hanging loops
 - avoids having to scan all clients to detect which one can accept data.

Signed-by: Frediano Ziglio <figlio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-03 16:02:37 +00:00
..
tests tests: make sure that the default rule builds all tests 2016-02-02 11:36:10 +00:00
.gitignore Update the .gitignore files for the new manual, 2015-10-16 15:48:23 -05:00
agent-msg-filter.c server: rename files 2015-12-03 23:54:32 +00:00
agent-msg-filter.h server: Add support for filtering out agent file-xfer msgs (rhbz#961848) 2013-06-06 16:07:30 +02:00
cache-item.h server: rename files 2015-12-03 23:54:32 +00:00
cache-item.tmpl.c server: rename _tmpl files 2015-11-26 13:33:36 +00:00
char-device.c Remove use of global 'reds' var from spice_server_remove_interface() 2016-02-03 08:41:37 +00:00
char-device.h Remove use of global 'reds' var from spice_server_remove_interface() 2016-02-03 08:41:37 +00:00
cursor-channel.c Remove GSlice use 2016-01-14 16:39:36 +00:00
cursor-channel.h server: rename files 2015-12-03 23:54:32 +00:00
dcc-encoders.c Remove compress_buf_new 2016-01-14 16:39:30 +00:00
dcc-encoders.h Remove compress_buf_new 2016-01-14 16:39:30 +00:00
dcc-send.c dcc-send: Use dcc_compress_image to compress image 2016-01-20 16:04:59 +00:00
dcc.c dcc: make dcc_compress_image_*() private 2016-01-20 16:05:02 +00:00
dcc.h dcc: make dcc_compress_image_*() private 2016-01-20 16:05:02 +00:00
demarshallers.h Remove trailing blank lines 2012-01-13 18:11:59 +02:00
dispatcher.c dispatcher: Remove unused dispatcher_read_message 2015-11-23 11:45:20 +00:00
dispatcher.h server: misc header cleanups 2015-12-09 22:17:51 +00:00
display-channel.c Remove use of spice_warn_if() 2016-01-19 17:15:49 +01:00
display-channel.h server: Remove an unneeded mjpeg-encoder.h include 2015-12-15 17:48:58 +00:00
display-limits.h worker: start a DisplayChannelClient unit 2015-11-19 12:43:02 +00:00
event-loop.c compatibility patch for event loop 2016-02-03 13:27:16 +00:00
glz-encode-match.tmpl.c server: rename _tmpl files 2015-11-26 13:33:36 +00:00
glz-encode.tmpl.c server: rename _tmpl files 2015-11-26 13:33:36 +00:00
glz-encoder-dict.c remove glz_encoder_config.h 2015-12-04 11:57:18 +00:00
glz-encoder-dict.h remove glz_encoder_config.h 2015-12-04 11:57:18 +00:00
glz-encoder-priv.h server: misc header cleanups 2015-12-09 22:17:51 +00:00
glz-encoder.c server: rename files 2015-12-03 23:54:32 +00:00
glz-encoder.h server: misc header cleanups 2015-12-09 22:17:51 +00:00
image-cache.c server: rename files 2015-12-03 23:54:32 +00:00
image-cache.h server: rename files 2015-12-03 23:54:32 +00:00
inputs-channel.c Remove use of global 'reds' var from spice_server_remove_interface() 2016-02-03 08:41:37 +00:00
inputs-channel.h Remove use of global 'reds' var from spice_server_remove_interface() 2016-02-03 08:41:37 +00:00
jpeg-encoder.c server: rename files 2015-12-03 23:54:32 +00:00
jpeg-encoder.h server: rename files 2015-12-03 23:54:32 +00:00
lz4-encoder.c server: rename files 2015-12-03 23:54:32 +00:00
lz4-encoder.h server: rename files 2015-12-03 23:54:32 +00:00
main-channel.c Move vdagent to RedsState struct 2016-02-01 14:05:36 +00:00
main-channel.h main_channel_init() -> main_channel_new() 2016-01-28 15:34:53 +00:00
main-dispatcher.c Change some functions to take RedsState arg 2016-01-20 15:26:25 +00:00
main-dispatcher.h channel: add a new internal SpiceCoreInterface 2016-01-11 16:29:53 +00:00
Makefile.am worker: use glib main loop 2016-01-28 16:16:50 +00:00
memslot.c server: misc header cleanups 2015-12-09 22:17:51 +00:00
memslot.h server: rename files 2015-12-03 23:54:32 +00:00
migration-protocol.h server: rename files 2015-12-03 23:54:32 +00:00
mjpeg-encoder.c server: Add time constants to go with spice_get_monotonic_time_ms() 2015-12-14 11:24:47 +00:00
mjpeg-encoder.h server: rename files 2015-12-03 23:54:32 +00:00
pixmap-cache.c syntax-check: Add missing #include <config.h> 2015-10-19 14:25:36 +02:00
pixmap-cache.h server: rename files 2015-12-03 23:54:32 +00:00
red-channel.c worker: push data when clients can receive them 2016-02-03 16:02:37 +00:00
red-channel.h channel: add a new internal SpiceCoreInterface 2016-01-11 16:29:53 +00:00
red-common.h event-loop: Remove template 2016-01-21 14:19:24 +00:00
red-dispatcher.c Move image_compression to RedsState struct 2016-02-02 15:45:10 +00:00
red-dispatcher.h server: misc header cleanups 2015-12-09 22:17:51 +00:00
red-parse-qxl.c check properly if red_get_data_chunks fails or not 2016-01-08 18:16:42 +00:00
red-parse-qxl.h server: rename files 2015-12-03 23:54:32 +00:00
red-record-qxl.c server: Use '%zu' to print size_t variables 2015-12-15 17:50:05 +00:00
red-record-qxl.h server: rename files 2015-12-03 23:54:32 +00:00
red-replay-qxl.c Replay: report error if we don't read the correct file header 2016-01-22 11:03:30 +00:00
red-replay-qxl.h server: rename files 2015-12-03 23:54:32 +00:00
red-worker.c worker: push data when clients can receive them 2016-02-03 16:02:37 +00:00
red-worker.h stats: use CLOCK_THREAD_CPUTIME_ID for cpu statistics 2016-01-11 16:29:08 +00:00
reds-private.h Move zlib_glz_state to RedsState struct 2016-02-03 15:14:46 +00:00
reds-stream.c reds-stream: add send_msgfd() 2016-01-14 10:55:36 +00:00
reds-stream.h reds-stream: add send_msgfd() 2016-01-14 10:55:36 +00:00
reds.c Move zlib_glz_state to RedsState struct 2016-02-03 15:14:46 +00:00
reds.h Move zlib_glz_state to RedsState struct 2016-02-03 15:14:46 +00:00
smartcard.c Change some functions to take RedsState arg 2016-01-18 16:01:12 +00:00
smartcard.h Remove spice-experimental 2015-01-15 18:34:26 +01:00
sound.c Change some functions to take RedsState arg 2016-01-21 14:42:58 +00:00
sound.h server: rename files 2015-12-03 23:54:32 +00:00
spice-audio.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-bitmap-utils.c utils: handle errors writing to bitmap file 2016-01-15 12:30:03 +00:00
spice-bitmap-utils.h server: misc header cleanups 2015-12-09 22:17:51 +00:00
spice-bitmap-utils.tmpl.c server: rename _tmpl files 2015-11-26 13:33:36 +00:00
spice-char.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-core.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-experimental.h Add missing license headers 2015-10-19 14:25:36 +02:00
spice-input.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-migration.h Move spice_server_get_num_clients() declaration 2014-11-27 15:03:38 +01:00
spice-qxl.h qxl: inline documentation for get_command and req_cmd_notification 2016-01-27 11:06:56 -06:00
spice-server.h channel: add option tcp keepalive timeout to channels 2016-01-12 15:10:47 +01:00
spice-server.syms channel: add option tcp keepalive timeout to channels 2016-01-12 15:10:47 +01:00
spice-version.h.in build-sys: generate spice-version.h 2014-11-27 14:27:33 +01:00
spice.h Split spice.h 2014-11-27 14:27:18 +01:00
spicevmc.c Change some functions to take RedsState arg 2016-01-18 16:01:12 +00:00
stat.h stat: Make stat_compress_init/stat_init the same 2016-01-12 11:46:32 +01:00
stream.c server: Use PRI macros in printf for 32/64 bit compatibility 2015-12-15 17:47:50 +00:00
stream.h server: Add time constants to go with spice_get_monotonic_time_ms() 2015-12-14 11:24:47 +00:00
sw-canvas.c server: misc header cleanups 2015-12-09 22:17:51 +00:00
sw-canvas.h server: rename files 2015-12-03 23:54:32 +00:00
tree.c pass proper type to SPICE_CONTAINEROF 2015-12-04 13:33:54 +00:00
tree.h Move some tree item functions to tree.[ch] 2015-11-17 17:22:05 +00:00
utils.c worker: move dcc_add_surface_area_image 2015-11-23 13:50:44 +00:00
utils.h server: Add time constants to go with spice_get_monotonic_time_ms() 2015-12-14 11:24:47 +00:00
zlib-encoder.c server: rename files 2015-12-03 23:54:32 +00:00
zlib-encoder.h server: rename files 2015-12-03 23:54:32 +00:00