summaryrefslogtreecommitdiffstats
path: root/server/reds.h
Commit message (Collapse)AuthorAgeFilesLines
* server: remove OpenGLMarc-André Lureau2015-11-211-2/+0
| | | | | | | | | | This is really not supported, requires X11, so better to remove it for now. Some day it might be revived, using DRM, .. Note for later, this could be removed too (not used by client): - spice-common/common/ogl_ctx Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
* worker: remove need for WorkerInitDataMarc-André Lureau2015-10-261-0/+16
| | | | | | Move code around to declare and place it where it fits better. Acked-by: Frediano Ziglio <fziglio@redhat.com>
* Move RedsMigSpice to main-channel.hJonathon Jongsma2015-08-111-7/+0
| | | | | This is the place that needs the complete type definition. If it is defined in reds.h, it can create circular references.
* Rename mm_timer/mm_timeMarc-André Lureau2014-11-271-2/+2
| | | | As suggested by Christophe on the mailing list.
* clean-up: remove unused functionMarc-André Lureau2014-09-081-1/+0
|
* Add reds_stream.[ch]Christophe Fergeau2014-01-201-64/+0
| | | | | Gather common RedsStream code there rather than having it in reds.c
* Move SPICE_GNUC_VISIBLE to red_common.hChristophe Fergeau2014-01-201-2/+0
|
* decouple disconnection of the main channel from client destructionYonit Halperin2013-07-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: move handle_channel_event logic from main_dispatcher to redsYonit Halperin2013-05-081-0/+4
| | | | | main_dispactcher role is to pass events to the main thread. The logic that handles the event better not be inside main_dispatcher.
* reds: support mm_time latency adjustmentsYonit Halperin2013-04-221-0/+2
| | | | | | | | 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.
* Revert "server: add websockets support via libwebsockets"Alon Levy2012-11-041-17/+0
| | | | This reverts commit 63bb37276e028ab1b1c156c9e7907bf22b6d5952.
* server: add websockets support via libwebsocketsAlon Levy2012-10-251-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New API: spice_server_set_ws_ports This adds an optional dependency on libwebsockets. You need to get my patched 0.0.3 version here: git://people.freedesktop.org/~alon/libwebsockets There is no qemu patches yet, to test change in reds.c the default value of spice_ws_port to 5959 (for the default of spice-html5). For testing there is an online client at http://spice-space.org/spice-html5/spice.html Known issues: 1. The tester (server/tests/test_display_no_ssl) gets into dropping all data after a few seconds, I think it's an issue with the implemented watches, but haven't figured it out. 2. libwebsocket's read interface is inverted to what our code expects, i.e. there is no libwebsocket_read, so there is an additional copy involved (see RedsWebSocket). This can be fixed. 3. Listening on a separate port. Since the headers are different, we could listen on the same port (first three bytes RED/GET). I don't know if we want to? Todos: 1. SSL not implemented yet. Needs some thought as to how. 2. Serve spice-html5 when accessed as a http server. Nice to have.
* main: restore state from migration dataYonit Halperin2012-08-271-1/+3
| | | | Also removed old migration leftovers.
* main: send migration dataYonit Halperin2012-08-271-1/+1
| | | | | Also removed some unused definitions from reds that used to belong to old agent and migration code.
* main: send MSG_MIGRATE upon vm migration completionYonit Halperin2012-08-271-0/+1
| | | | | | | | | Before sending the above msg, if there is a pending partial msg that has been read from the agent, we send it to the client. The alternative was to keep the msg as part of the migration data, and then to send it to the destination server via the client and to wait there for the msg chunk completion, before sending it to the client. Of course, the latter is less efficient.
* seamless migration: migration completion on the destination sideYonit Halperin2012-08-271-1/+2
| | | | | | 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.
* seamless migration: pre migration phase on the destination sideYonit Halperin2012-08-271-0/+3
| | | | | | | | | | - handle SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS - reply with SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK/NACK - prepare the channels for migration according to the migration type (semi/seamless) see spice-protocol for more details: commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f
* seamless migration: pre migration phase on the src sideYonit Halperin2012-08-271-2/+2
| | | | | | | | | | | | | | sending SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS and handling SPICE_MSGC_MAIN_MIGRATE_CONNECTED_SEAMLESS The src side signals the client to establish a connection to the destination. In seamless migration, the client is also used to perform a sort of handshake with the destination, for verifying if seamless migration can be supported. see spice-protocol for more details: commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f
* reds: add tracking for char devicesYonit Halperin2012-08-271-0/+1
| | | | | | The list of attached char_devices will be used in the next patch for notifying each instance of SpiceCharDeviceState when the vm is started or stopped.
* agent: use SpiceCharDeviceWriteBuffer for agent data from the clientYonit Halperin2012-07-031-0/+2
| | | | | This is an intermediate patch. The next patch will actually push the buffer to the device, instead of copying it.
* agent: Fix tokens handling in main_channelYonit Halperin2012-07-031-1/+2
| | | | | | | | | | | | - Allow sending tokens to a specific client. - Do not ignore tokens that are sent from the client to the server. The tokens support for multiple clients and for server side tokens is still broken in reds. It will be fixed in following patches, when the server-side agent code will use the SpiceCharDeviceState api. Notice that ignoring the server-side tokens didn't introduce a problem since both the client and the server set it to ~0.
* Send name & uuid to capable clientsMarc-André Lureau2012-03-051-0/+1
| | | | | | | | | Add spice_server_set_name() and spice_server_set_uuid() that allows the client to identify a Spice server (useful to associate settings with a particular server) The SPICE_MSG_MAIN_NAME and SPICE_MSG_MAIN_UUID messages are only sent to capable clients, announcing SPICE_MAIN_CAP_NAME_AND_UUID.
* server, separate SpiceChannelEventInfo from RedStreamAlon Levy2012-02-151-1/+5
| | | | | | | | | | fixes rhbz 790749 use after free of SpiceChannelEventInfo. The lifetime of the SpiceChannelEventInfo was that of RedsStream, but it is used by main_dispatcher_handle_channel_event after the RedsStream is freed for the cursor and display channels. Making SCEI allocation be at RedsStream allocation, and deallocation after the DESTROY event is processed by core->channel_event, fixes use after free.
* Remove trailing blank linesDaniel P. Berrange2012-01-131-1/+0
| | | | Remove any blank lines at the end of all source files
* server: handling semi-seamless migration in the target sideYonit Halperin2011-11-021-1/+1
| | | | | | | | | | (1) not sending anything to a migrated client till we recieve SPICE_MSGC_MIGRATE_END (2) start a new client migration (handle client_migrate_info) only after SPICE_MSGC_MIGRATE_END from the previous migration was received for this client (3) use the correct ticket Note: we assume the same channles are linked before and ater migration. i.e., SPICE_MSGC_MAIN_ATTACH_CHANNELS is not sent from the clients.
* server: handle spice_server_migrate_endYonit Halperin2011-11-021-2/+0
| | | | | | | | | | | | | | | | If the migration has completed successfully: (1) send MSG_MAIN_MIGRATE_END to the clients that are connected to the target (2) send MSG_MAIN_SWITCH_HOST to all the other clients If the migration failed, send MSG_MAIN_MIGRATE_CANCEL to clients that are connected to the target. (cherry picked from commit 4b82580fc36228af13db4ac3c403753d6b5c40b5 branch 0.8; Was modified to support multiple clients, and the separation of main_channel from reds) Conflicts: server/reds.c
* server,proto: tell the clients to connect to the migration target before ↵Yonit Halperin2011-11-021-3/+11
| | | | | | | | | | | | | | | migraton starts (1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect (to all the clients that support it) (2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) from all the relevant clients, or a timeout, in order to complete client_migrate_info monitor command (cherry picked from commit 5560c56ef05c74da5e0e0825dc1f134019593cad branch 0.8; Was modified to support the separation of main channel from reds, and multiple clients) Conflicts: server/reds.c
* server: handle migration interface additionYonit Halperin2011-11-021-0/+4
| | | | | | | | (cherry picked from commit 3ac0075cdac8fa42de47a7882022795e96cb1fee branch 0.8) Conflicts: server/reds.h
* server: fix function prototypesChristophe Fergeau2011-09-051-2/+2
| | | | | | | | Several functions in server/ were not specifying an argument list, ie they were declared as void foo(); When compiling with -Wstrict-prototypes, this leads to: test_playback.c:93:5: erreur: function declaration isn’t a prototype [-Werror=strict-prototypes]
* server: add public spice_server_get_num_clientsAlon Levy2011-08-231-0/+1
|
* server: registering RedChannel in reds, instead of ChannelYonit Halperin2011-08-231-24/+3
| | | | | | | | | | | | | | | | | | | | | | | Merging the functionality of reds::channel, into RedChannel. In addition, cleanup and fix disconnection code: before this patch, red_dispatcher_disconnect_display_client could have been called from the red_worker thread (and it must be called only from the io thread). RedChannel holds only connected channel clients. RedClient holds all the channel clients that were created till it is destroyed (and then it destroys them as well). Note: snd_channel still doesn't use red_channel, however it creates dummy channel and channel clients, in order to register itself in reds. server/red_channel.c: a channel is connected if it holds at least one channel client Previously I changed RedChannel to hold only connected channel clients and RedClient, to hold all the channel clients as long as it is not destroyed. usbredir: multichannel has not been tested, it just compiles.
* server/main_channel: support multiple clientsAlon Levy2011-08-231-3/+3
| | | | | | | | | | | | | | | | The main channel deals with connecting new clients, announcing mouse mode changes, and the agent channel. The implementation is currently done without any changes to the protocol, so everything has to be either broadcast or to a specific client. channels list - specific client mouse mode - broadcast agent - broadcast notify - broadcast (should have two modes, and use the appropriate) Notable TODOs: * migration testing * agent tokens are wrongly sent (or did I fix that? check)
* server/main_channel: move latency and bitrate to channel clientAlon Levy2011-08-231-3/+0
| | | | | | | | | | | | They were globals before. This introduces api for other channels to query the low bandwidth status. The queries themselves are still done from the wrong context (channel and not channel client) but that's because the decoupling of channel and channel client will be done in the following patches. Note that snd_worker.c got two copied function declarations that belong to main_channel.h but can't be easily dragged into snd_worker.c since it still uses it's own RedChannel struct.
* server: Add RedClientAlon Levy2011-08-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That means RedClient tracks a ring of channels. Right now there will be only a single client because of the disconnection mechanism - whenever a new client comes we disconnect all existing clients. But this patch adds already a ring of clients to reds.c (stored in RedServer). There is a known problem handling many connections and disconnections at the same time, trigerrable easily by the following script: export NEW_DISPLAY=:3.0 Xephyr $NEW_DISPLAY -noreset & for ((i = 0 ; i < 5; ++i)); do for ((j = 0 ; j < 10; ++j)); do DISPLAY=$NEW_DISPLAY c_win7x86_qxl_tests & done sleep 2; done I fixed a few of the problems resulting from this in the same patch. This required already introducing a few other changes: * make sure all removal of channels happens in the main thread, for that two additional dispatcher calls are added to remove a specific channel client (RED_WORKER_MESSAGE_CURSOR_DISCONNECT_CLIENT and RED_WORKER_MESSAGE_DISPLAY_DISCONNECT_CLIENT). * change some asserts in input channel. * make main channel disconnect not recursive * introduce disconnect call back to red_channel_create_parser The remaining abort is from a double free in the main channel, still can't find it (doesn't happen when running under valgrind - probably due to the slowness resulting from that), but is easy to see when running under gdb.
* server/main_channel: use MainChannel in sigAlon Levy2011-08-231-0/+1
| | | | | | | use MainChannel* instead of Channel* for a many functions in main_channel.h (affects main_channel.c and reds.c). some one liner fixes are hidden in here too.
* server/reds.h: explicitly include config.hAlon Levy2011-08-231-0/+2
|
* s/__visible__/SPICE_GNUC_VISIBLEChristophe Fergeau2011-06-221-1/+1
| | | | | The C specification reserves use of identifiers starting with __ to the compiler so we shouldn't use one such symbol.
* add #include <config.h> to all source filesChristophe Fergeau2011-05-031-2/+0
| | | | | | | | When using config.h, it must be the very first include in all source files since it contains #define that may change the compilation process (eg libc structure layout changes when it's used to enable large file support on 32 bit x86 archs). This commit adds it at the beginning of all .c and .cpp files
* server: s/desable/disableChristophe Fergeau2011-05-021-1/+1
| | | | | This fixes a typo in some function names, there should be no functional change.
* use foo(void) instead of foo() in prototypesChristophe Fergeau2011-05-021-6/+6
| | | | | In C, the latter isn't a prototype for a function with no arg, but declares a function with an undefined number of args.
* server: add SASL supportMarc-André Lureau2011-02-281-0/+39
| | | | | | | | | | | | We introduce 2 public functions to integrate with the library user. spice_server_set_sasl() - turn on SASL spice_server_set_sasl_appname() - specify the name of the app (It is used for where to find the default configuration file) The patch for QEMU is on its way. https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: add reds_channel_dispose()Marc-André Lureau2011-02-281-0/+2
| | | | | | | | | | Try to have a common base dispose() method for channels. For now, it just free the caps. Make use of it in snd_worker, and in sync_write() - sync_write() is going to have default caps later on. https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: rename s/peer/streamMarc-André Lureau2011-02-281-1/+1
| | | | | | | | 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
* server/reds: remove the void* ctx fieldMarc-André Lureau2011-02-281-2/+0
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: use the new reds_stream_{read,write}Marc-André Lureau2011-02-281-5/+0
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: remove cb_free, not needed anymoreMarc-André Lureau2011-02-271-1/+0
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: add reds_stream_{read,write,free,remove_watch}()Marc-André Lureau2011-02-271-2/+14
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: s/RedsStreamContext/RedsStreamMarc-André Lureau2011-02-271-4/+4
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server/reds: remove unused readvMarc-André Lureau2011-02-271-1/+0
| | | | | | Let's not bother with it since nobody uses it, and it's not implemented for SSL anyway https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server/reds: s/reds_push_migrate_data_item/reds_marshall_migrate_data_item/Alon Levy2011-01-131-1/+1
|