summaryrefslogtreecommitdiffstats
path: root/server/reds.c
Commit message (Collapse)AuthorAgeFilesLines
* server: handling semi-seamless migration in the target sideYonit Halperin2011-09-251-20/+116
| | | | | | | | | | (1) not sending anything to the client till we recieve SPICE_MSGC_MIGRATE_END (2) start a new migration (handle client_migrate_info) only after SPICE_MSGC_MIGRATE_END from the previous migration has been received (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 client.
* server: move the linking of channels to a separate routineYonit Halperin2011-09-251-26/+41
|
* server: move SPICE_MSG_MAIN_INIT sending code to a separate routineYonit Halperin2011-09-251-23/+33
|
* server: send SPICE_MSG_MAIN_MIGRATE_END on spice_server_migrate_endYonit Halperin2011-09-251-18/+67
|
* server,proto: tell the client to connect to the migration target before ↵Yonit Halperin2011-09-251-37/+111
| | | | | | | | migraton starts (1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect (2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR), or a timeout, in order to complete client_migrate_info monitor command
* server: handle migration interface additionYonit Halperin2011-09-251-0/+29
|
* server/spice.h: semi-seamless migration interface, RHBZ #738266Yonit Halperin2011-09-251-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | semi-seamless migration details: migration source side --------------------- (1) spice_server_migrate_connect (*): tell client to link to the target side - send SPICE_MSG_MAIN_MIGRATE_BEGIN. This should be called upon client_migrate_info cmd. client_migrate_info is asynchronous. (2) Complete spice_server_migrate_connect only when the client has been connected to the target - wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) or a timeout. (3) spice_server_migrate_end: tell client migration it can switch to the target - send SPICE_MSG_MAIN_MIGRATE_END. (4) client cleans up all data related to the connection to the source and switches to the target. It sends SPICE_MSGC_MAIN_MIGRATE_END. migration target side --------------------- (1) the server identifies itself as a migraiton target since the client is linked with (connection_id != 0) (2) server doesn't start the channels' logic (channel->link) till it receives SPICE_MSGC_MAIN_MIGRATE_END from the client. * After migration starts, the target qemu is blocked and cannot accept new spice client connections. Thus, we trigger the connection to the target upon client_migrate_info command.
* fix make distcheckChristophe Fergeau2011-07-221-1/+1
|
* use foo(void) instead of foo() in prototypesChristophe Fergeau2011-07-211-3/+3
| | | | | | | | In C, the latter isn't a prototype for a function with no arg, but declares a function with an undefined number of args. [picked from master with changes since no main_channel, spice_common, and a bunch of functions aren't there yet]
* s/__visible__/SPICE_GNUC_VISIBLEChristophe Fergeau2011-07-211-43/+43
| | | | | | | The C specification reserves use of identifiers starting with __ to the compiler so we shouldn't use one such symbol. [cherry-pick from master]
* Fix spice-server/qemu channel version checksChristophe Fergeau2011-07-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When qemu creates a channel, reds.c contains code to check the minor/major channel versions known to QEMU (ie the ones that were current in spice-server when QEMU was compiled) and to compare these versions against the current ones the currently installed spice-server version. According to kraxel [1], the rules for these interface numbers are: "The purpose of the versions is exactly to avoid the need for a new soname. The rules are basically: (1) You add stuff to the interface, strictly append-only to not break binary compatibility. (2) You bump the minor version of the interface. (3) You check the minor version at runtime to figure whenever the added fields contain valid stuff or not. An example is here (core interface, minor goes from 2 to 3, new channel_event callback): http://cgit.freedesktop.org/spice/spice/commit/?id=97f33fa86aa6edd25111b173dc0d9599ac29f879 " The code currently refuses to create a channel if QEMU minor version is less than the current spice-server version. This does not correspond to the intended behaviour, this patch changes to fail is qemu was compiled with a spice-server that is *newer* than the one currently installed. This case is something we cannot support nicely. [1] http://lists.freedesktop.org/archives/spice-devel/2011-July/004440.html
* server/smartcard: register channel only when hardware is availableAlon Levy2011-07-211-4/+0
|
* server: add SASL supportMarc-André Lureau2011-07-211-7/+710
| | | | | | | | | | | | | | | | | 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 Conflicts: server/reds.c server/reds.h
* server: add auth mechanism selectionMarc-André Lureau2011-07-211-4/+64
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: add reds_channel_dispose()Marc-André Lureau2011-07-211-0/+11
| | | | | | | | | | 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: simplify and constify sync_write()Marc-André Lureau2011-07-211-17/+25
| | | | | | + symplify, improving style of code using it. https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: pull out reds_handle_link(), for future reuseMarc-André Lureau2011-07-211-9/+16
| | | | | | + a couple of indent, style change https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server/reds: make writev fallback more genericMarc-André Lureau2011-07-211-26/+17
| | | | | | We are going to reuse it for SASL/SSF encode write(). https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: rename s/peer/streamMarc-André Lureau2011-07-211-132/+131
| | | | | | | | 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-07-211-2/+0
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: use the new reds_stream_{read,write}Marc-André Lureau2011-07-211-47/+36
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: remove cb_free, not needed anymoreMarc-André Lureau2011-07-211-19/+0
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: use reds_{link,stream}_free()Marc-André Lureau2011-07-211-41/+22
| | | | | | Be carefull removing the watch before, like __release_link https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: use reds_stream_remove_watch() helperMarc-André Lureau2011-07-211-8/+4
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: add reds_stream_{read,write,free,remove_watch}()Marc-André Lureau2011-07-211-1/+61
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: s/RedsStreamContext/RedsStreamMarc-André Lureau2011-07-211-19/+19
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server/reds: remove unused readvMarc-André Lureau2011-07-211-2/+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: make sure we clear vdagent and update mouse mode on agent disconnectHans de Goede2011-04-011-3/+0
| | | | | | | | The check this patch removes causes us to not set vdagent to NULL, nor update the mouse mode when the guest agent disconnects when no client is attached. Which leads to a non working mouse, and on agent reconnect a "spice_server_char_device_add_interface: vdagent already attached" message instead of a successful re-add of the agent interface .
* server: ignore SPICE_MSGC_MAIN_AGENT_START messages when there is no agentHans de Goede2011-04-011-1/+1
| | | | | This can happen for example when a SPICE_MSGC_MAIN_AGENT_START message from the client and the vdagent disconnecting race.
* server: hookup agent-msg-filter discard-all functionalityHans de Goede2011-04-011-33/+23
| | | | | | | This ensures that if the client or agent connects to the client-agent "tunnel" while the other side is halfway through sending a multi part message, the rest of the message gets discarded, and the connecting party starts getting data at the beginning of the next message.
* server: add discard all option to agent message filterHans de Goede2011-04-011-4/+5
|
* server: filter all data from clientHans de Goede2011-04-011-11/+11
| | | | | Filter all data from client, even when there is no agent connected to keep filter state correct.
* server: reset read/write filter on agent/client disconnectHans de Goede2011-04-011-0/+2
| | | | | | The agent message filter keeps track of messages as they are being send reset the relevant filter to its initial state when one of the 2 ends of the agent<->client "tunnel" disconnects.
* server: break read_from_vdi_port loop if the guest gets disconnectedHans de Goede2011-04-011-1/+1
| | | | | | | read_from_vdi_port calls dispatch_vdi_port data, which will disconnect the guest agent if it sends invalid data. It would then try to read more data from the disconnected guest agent resulting in a NULL ptr dereference, this patch fixes this.
* server: Don't stop writing agent data to the guest when the client disconnectsHans de Goede2011-04-011-2/+2
| | | | | | | | write_to_vdi_port() was checking for reds->agent_state.connected to determine wether it could write queued data. But agent_state.connected reflects if *both* ends are connected. If the client has disconnected, but the guest agent is still connected and some data is still pending (like a final clipboard release from the client), then this data should be written to the guest agent.
* server: Don't reset agent state when the client disconnectsHans de Goede2011-04-011-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were calling reds_reset_vdp on client disconnect, which is not a good idea. reds_reset_vdp does 3 things: 1) It resets the state related to reading chunks from the spicevmc virtio port. If the client disconnects while the guest agent is in the middle of sending a chunk, this will lead to an inconsistent state, and lots of printing of "dispatch_vdi_port_data: invalid port" messages caused by this inconsistent state sometimes followed by a segfault. This can be triggered by copy and pasting something large (say a screenshot) from the guest to the spice-gtk client, as the spice-gtk client currently has a bug causing it to crash when receiving a multi chunk vdagent messages. Without this patch (and with the spice-gtk bug present) I can consistently reproduce this. 2) It clears any buffered writes from the client to the guest still pending because the virtio port cannot consume data fast enough. Since the agent itself is still running fine, throwing away writes for it because the client has disconnected makes no sense. Esp, since on clean exit the client may very well send a clipboard release message directly before closing the connection, and this may get lost this way. 3) It sets client_agent_started to false, this is the only thing which actually makes sense to do on client disconnect. Note that since we no longer reset the vdp state on client disconnect, we must now reset it on agent disconnect even if we don't have a client. So the reds_reset_vdp call in reds_agent_remove() gets moved to the top, above both the agent_state.connected and reds->peer checks which will both fail in the no client case.
* server: Make copy paste support configurableHans de Goede2011-03-241-2/+12
| | | | | | Also bump SPICE_SERVER_VERSION to 0x000801 as 0.8.1 will be the first version with the new API for this, and we need to be able to detect the presence of this API in qemu.
* spice-server: Add the ability to filter agent messagesHans de Goede2011-03-241-3/+32
|
* server/reds: allow call to reds_agent_remove even if it is goneAlon Levy2011-03-081-4/+4
| | | | | | | | | | | | | | | | | | | | | The current assert(reds->agent_state.connected) tiggers if when the agent disconnected there was still data waiting to be sent (for instance if there is a bug in the client handling clipboard and it is killed while a large clipboard transfer is in progress). So first call to reds_agent_remove happens from spice_server_char_device_remove_interface, and then it is called again (triggering the assert) from free_item_data from read_from_vdi_port because of the channel destruction. Other option would be to not call it from one of the paths - but that is suboptimal: * if there is no data in the pipe, the second call never happens. * the second call has to be there anyway, because it may fail during parsing data from the agent. This patch fixes a segfault on this assert when a client starts passing from guest agent to client a large clipboard and dies in the middle. There is still another assert happening occasionally at marshaller which I don't have a fix for (but it doesn't seem to be related).
* fix spice-server segfault on migrationGerd Hoffmann2011-02-151-0/+4
| | | | | | | spice-server tries to use the migration information without checking whenever this is available in the first place ... Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* client/server: warning fixes (gcc 4.6.0)Alon Levy2011-01-271-2/+3
| | | | | gcc 4.6.0 added "[-Werror=unused-but-set-variable]", this and the next few fixes tend to that. Mostly harmless.
* client/server: add missing USE_TUNNELAlon Levy2011-01-251-0/+2
| | | | | disable some code that only makes sense when USE_TUNNEL is defined in client and server channel security level setting.
* client/server: add missing smartchannel channel security handlingAlon Levy2011-01-251-0/+3
| | | | | The name to channel id mapping for the smartcard channel is missing, add it in client and server.
* client migration: switch hostGerd Hoffmann2010-12-161-10/+56
| | | | | | | | | | | | | | | | | Implement server-side support for switch-host client migration. Client side support is present already in the tree. Setting the migration information is done using the existing spice_server_migrate_info() function. A new spice_server_migrate_switch() function has been added which triggers sending out the switch-host message. Seamless migration functions are left there for now. spice_server_migrate_start() has been chamnged to just fail unconditionally though as seamless migration is broken anyway. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit 4b1ea4e102bb8a737487dab51dd0f3fc94352948)
* server: improve error handlingGerd Hoffmann2010-12-091-8/+24
| | | | | | | | | We should pass up errors instead of aborting. Do that at least for bind() failures which actually happen in real live due to the tcp port being busy. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit aafd8eea74acb23fc818b49824a74c4d885c3504)
* smartcard: server side (not enabled yet)Alon Levy2010-12-071-0/+24
|
* server: add spice_server_char_device_remove_interfaceAlon Levy2010-12-071-5/+14
|
* server: print subtype when adding CHAR_DEVICE interfacesAlon Levy2010-12-061-1/+1
|
* server: add static to spice_server_char_device_add_interfaceAlon Levy2010-12-061-1/+1
|
* server: fix print text on vdagent interface additionAlon Levy2010-12-061-1/+1
|