summaryrefslogtreecommitdiffstats
path: root/server/main_dispatcher.h
Commit message (Collapse)AuthorAgeFilesLines
* Add missing license headersChristophe Fergeau2015-10-191-0/+17
|
* decouple disconnection of the main channel from client destructionYonit Halperin2013-07-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes rhbz#918169 Some channels make direct calls to reds/main_channel routines. If these routines try to read/write to the socket, and they get socket error, main_channel_client_on_disconnect is called, and triggers red_client_destroy. In order to prevent accessing expired references to RedClient, RedChannelClient, or other objects (inside the original call, after red_client_destroy has been called) I made the call to red_client_destroy asynchronous with respect to main_channel_client_on_disconnect. I added MAIN_DISPATCHER_CLIENT_DISCONNECT to main_dispatcher. main_channel_client_on_disconnect pushes this msg to the dispatcher, instead of calling directly to reds_client_disconnect. The patch uses RedClient ref-count in order to handle a case where reds_client_disconnect is called directly (e.g., when a new client connects while another one is connected), while there is already CLIENT_DISCONNECT msg pending in the main_dispatcher. Examples: (1) snd_worker.c snd_disconnect_channel() channel->cleanup() //snd_playback_cleanup reds_enable_mm_timer() . . main_channel_push_multi_media_time()...socket_error . . red_client_destory() . . snd_disconnect_channel() channel->cleanup() celt051_encoder_destroy() celt051_encoder_destory() // double release Note that this bug could have been solved by changing the order of calls: e.g., channel->stream = NULL before calling cleanup, and some other changes + reference counting. However, I found other places in the code with similar problems, and I looked for a general solution, at least till we redesign red_channel to handle reference counting more consistently. (2) inputs_channel.c inputs_connect() main_channel_client_push_notify()...socket_error . . red_client_destory() . . red_channel_client_create() // refers to client which is already destroyed (3) reds.c reds_handle_main_link() main_channel_push_init() ...socket error . . red_client_destory() . . main_channel_client_start_net_test(mcc) // refers to mcc which is already destroyed This can explain the assert in rhbz#964136, comment #1 (but not the hang that occurred before).
* reds: support mm_time latency adjustmentsYonit Halperin2013-04-221-0/+1
| | | | | | | | When there is no audio playback, we set the mm_time in the client to be older than the one in the server by at least the requested latency (the delta is actually bigger, due to the network latency). When there is an audio playback, we adjust the mm_time in the client by adjusting the playback buffer using SPICE_MSG_PLAYBACK_LATENCY.
* dispatcher.h: fix - s/#define MAIN_DISPATCHER_H/#define DISPATCHER_HYonit Halperin2013-04-221-0/+1
|
* seamless migration: migration completion on the destination sideYonit Halperin2012-08-271-0/+1
| | | | | | Tracking the channels that wait for migration data. If there is a new migration process pending, when all the channels have restored their state, we begin the new migration.
* [0.8 branch] server: add main_dispatcherAlon Levy2011-10-311-0/+9
add main_dispatcher, a message passing mechanism for sending messages to the main thread. The main thread is the thread that implements SpiceCoreInterface, which is assumed to be a single thread. Similar to the async operation of red_worker, a socket pair is created and used to pass messages. The messages are a fixed size to ease parsing. A single message is defined to pass a channel_event. RHBZ: 746950 FDBZ: 41858 This patch is 0.8 branch only, for the master branch there should be a better approach to share code with red_dispatcher and ready the way for later adding more threads. cherry-pick from 0.8 80caf07e09efe14c67f89a3c01501a6a39681167 Conflicts: server/reds.c