summaryrefslogtreecommitdiffstats
path: root/server/main_channel.c
Commit message (Collapse)AuthorAgeFilesLines
* main channel: Remove unused main_channel_client_get_link_idPavel Grunt2015-11-231-5/+0
| | | | | | | | It was introduced in 9cece23ba3e49e6eec9e380daa95d6ee0133c91c but never used. Signed-off-by: Pavel Grunt <pgrunt@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
* main channel: Remove unused main_channel_push_notifyPavel Grunt2015-11-231-6/+0
| | | | | | | It is not needed since 8d44aa032892ea6643925fa7485d9af32853e127 Signed-off-by: Pavel Grunt <pgrunt@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
* reuse red_get_monotonic_time functionFrediano Ziglio2015-11-231-8/+2
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
* Remove unused struct RedsOutItemJonathon Jongsma2015-08-111-5/+0
|
* server: Weakly try to get a better latency value for the bandwidth test.Francois Gouget2015-07-201-1/+2
| | | | | | | | | NET_TEST_WARMUP_BYTES is 0 so the warmup ping is the same as the one we use to measure the latency. Even if it was not, the actual latency would be the MIN() of both anyway so we might as well use both roundtrip times to ward off latency jitter a bit. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* server: Don't reset the latency before showing it in the invalid net test ↵Francois Gouget2015-07-201-3/+3
| | | | | | error message. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* main_channel: monitoring client connection statusYonit Halperin2013-08-141-6/+21
| | | | | | | rhbz#994175 Start monitoring if the client connection is alive after completing the bit-rate test.
* decouple disconnection of the main channel from client destructionYonit Halperin2013-07-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* main_channel: fix double release of migration target dataYonit Halperin2013-05-231-0/+2
| | | | | | | If client_migrate_info was called once with cert-host-subject and then again without cert-host-subject, on a third call to client_migrate info, the cert-host-subject from the first call would have been freed for the second time.
* main_channel: add routine for checking if a network test had been conducted ↵Yonit Halperin2013-05-081-1/+9
| | | | and completed
* red_worker: start using mjpeg_encoder rate control capabilitiesYonit Halperin2013-04-221-0/+5
| | | | | | | | | | This patch only employs setting the stream parameters based on the initial given bit-rate, the latency, and the encoding size. Later patches will also employ mjpeg_encoder response to client reports, and its control over frame drops. The patch also removes old stream bit rate calculations that weren't used.
* red_channel: monitor connection latency using MSG_PINGYonit Halperin2013-04-221-1/+1
|
* main-channel: Add a main_channel_client_push_notify functionHans de Goede2013-03-151-1/+6
| | | | | | | Sometimes we want to send a notify to a single client, rather then to all of them. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* main-channel: Make main_channel_push_notify deal with dynamic memoryHans de Goede2013-03-151-19/+12
| | | | | | | | | | | Currently main_channel_push_notify only gets passed a static string, but chances are in the future it may get passed dynamically allocated strings, prepare it for this. While at it also make clear that its argument is a string, and simplify things a bit by making use of this knowledge (pushing the strlen call down). Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* enable seamless migration and set migration protocol versionYonit Halperin2012-08-271-0/+1
|
* main_channel: don't expect init msg in a seamless migration destinationYonit Halperin2012-08-271-3/+8
| | | | | If the server is a destination of seamless migration, send msgs to the client, even though an init msg has not been sent to the client.
* red_channel: remove unused migrate flag from RedChannelYonit Halperin2012-08-271-1/+1
| | | | The relevant flags reside in RedChannelClient and RedClient
* main: restore state from migration dataYonit Halperin2012-08-271-20/+14
| | | | Also removed old migration leftovers.
* main: send migration dataYonit Halperin2012-08-271-11/+3
| | | | | 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/+10
| | | | | | | | | 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.
* main_channel: fix using spice messages enums as pipe items typeYonit Halperin2012-08-271-106/+147
| | | | | | | | | A channel pipe item type must start from PIPE_ITEM_TYPE_CHANNEL_BASE. SPICE_MSG_MIGRATE value eq. PIPE_ITEM_TYPE_SET_ACK. Setting a pipe item type to SPICE_MSG_MIGRATE, leads to red_channel handling PIPE_ITEM_TYPE_SET_ACK. Also removed sending SPICE_MSG_MIGRATE. It will be handled in the next patch.
* seamless migration: migration completion on the destination sideYonit Halperin2012-08-271-3/+8
| | | | | | 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.
* red_channel: handle sending SPICE_MSG_MIGRATEYonit Halperin2012-08-271-2/+3
| | | | | | | The relevant code is common to all channels. The patch also contains a fix to the return value for handle_migrate_data callback: s/uint64_t/int
* seamless migration: pre migration phase on the destination sideYonit Halperin2012-08-271-3/+20
| | | | | | | | | | - 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-21/+112
| | | | | | | | | | | | | | 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
* seamless-migration: update spice-common submoduleYonit Halperin2012-08-271-8/+8
| | | | | | Also Update server and client according to the change of SpiceMsgMainMigrationBegin: it now holds all the fields inside SpiceMigrationDstInfo.
* agent: reset client tokens when notifying on agent connectionYonit Halperin2012-08-271-1/+16
| | | | send SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS
* agent: use SpiceCharDeviceWriteBuffer for agent data from the clientYonit Halperin2012-07-031-1/+9
| | | | | This is an intermediate patch. The next patch will actually push the buffer to the device, instead of copying it.
* agent: employ SpiceCharDeviceState for managing reading from the deviceYonit Halperin2012-07-031-38/+14
|
* agent: Fix tokens handling in main_channelYonit Halperin2012-07-031-15/+17
| | | | | | | | | | | | - 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.
* server: handle red_channel_client_create returning NULLYonit Halperin2012-05-211-1/+1
|
* Use the spice-common logging functionsMarc-André Lureau2012-03-251-33/+33
| | | | | It will abort by default for critical level messages. That behaviour can be tuned at runtime.
* Use the spice-common submoduleMarc-André Lureau2012-03-251-5/+6
| | | | | | | | | | | | | | | | | | This patch will replace the common/ directory with the spice-common project. It is for now a simple project subdirectory shared with spice-gtk, but the goal is to make it a proper library later on. With this change, the spice-server build is broken. The following commits fix the build, and have been seperated to ease the review. v2 - moves all the generated marshallers to spice-common library - don't attempt to fix windows VS build, which should somehow be splitted with spice-common (or built from tarball only to avoid generation tools/libs deps) v3 - uses libspice-common-client - fix a mutex.h inclusion reported by Alon
* Use spice_strdup() to avoid crashing on NULLMarc-André Lureau2012-03-231-2/+2
| | | | | qemu can call spice_server_set_name(s, NULL) when the name is not given. Let's not crash in this case
* Ensure all members of ChannelCbs and ClientCbs are either assigned or NULLHans de Goede2012-03-101-1/+1
| | | | | | | | | | | | | | | While git-bisecting another issue I ended up hitting and not recognizing the bug fixed by commit 7a079b452b026d6ce38f95dcc397fa64b059fffb. While fixing this (again) I noticed that (even after the fix) not all users of ChannelCbs first zero it. So this patch ensures that all users of ChannelCbs first zero it, and does the same for ClientCbs while at it. Since before this patch there were multiple zero-ing styles, some using memset and other using a zero initializer this patch also unifies all the zero-ing to use a NULL initializer for the first element. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Send name & uuid to capable clientsMarc-André Lureau2012-03-051-0/+65
| | | | | | | | | 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: fix segfault on client disconnectAlon Levy2012-02-261-2/+1
| | | | | ..as a result of missing initialization of newly introduced pre_disconnect in main channel.
* Use standard IOV_MAX definition where applicableDan McGee2012-02-211-2/+0
| | | | | | | | This is provided by <limits.h> on all platforms as long as _XOPEN_SOURCE is defined. On Linux, this is 1024, on Solaris, this is 16, and on any other platform, we now respect the value supported by the OS. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
* Fix line length errors in main_channelDan McGee2012-01-231-11/+12
| | | | | | | | | | | | | These are all existing errors; fix them so they don't block future commits in this file unnecessarily. error (1): length @ server/main_channel.c +369 error (2): length @ server/main_channel.c +444 error (3): length @ server/main_channel.c +764 error (4): length @ server/main_channel.c +932 error (5): length @ server/main_channel.c +1044 Signed-off-by: Dan McGee <dpmcgee@gmail.com>
* Remove trailing blank linesDaniel P. Berrange2012-01-131-1/+0
| | | | Remove any blank lines at the end of all source files
* server: Limit the access to SpiceDataHeader of messages - only via red_channel.Yonit Halperin2012-01-121-2/+6
|
* server/main_channel: fix pointer-to-int-cast errorAlon Levy2011-11-101-2/+9
| | | | 64 bit-ism removed.
* server/main_channel: use PRIu64 where neededAlon Levy2011-11-101-2/+4
|
* server: add prefix argument to red_printf_debugAlon Levy2011-11-071-1/+1
| | | | | printed before function name. No central location for prefixes. Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
* server: handling semi-seamless migration in the target sideYonit Halperin2011-11-021-4/+50
| | | | | | | | | | (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-41/+70
| | | | | | | | | | | | | | | | 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-71/+93
| | | | | | | | | | | | | | | 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: set & test channel capabilities in red_channelYonit Halperin2011-11-021-14/+13
| | | | | | | The code for setting and testing channel capabilities was unnecessarily duplicated. Now it is in red_channel. RedsChannel was dropped from Reds; It was used only for holding the channels common capabilities, which are now held in RedChannel.
* server/reds: fix reds_main_channel_connectedAlon Levy2011-08-231-0/+5
| | | | | instead of checking just for reds->main_channel check that there is at least one client as well.
* server/main_channel: reduce verbose agent data commandAlon Levy2011-08-231-1/+2
| | | | by using the new SPICE_DEBUG_LEVEL.