summaryrefslogtreecommitdiffstats
path: root/server
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing whitespace from end of linesDaniel P. Berrange2012-01-136-24/+24
|
* Add missing includes of config.hDaniel P. Berrange2012-01-1310-0/+10
| | | | Not all files were including config.h
* Remove bogus include of strings.hDaniel P. Berrange2012-01-134-4/+0
| | | | The tests include strings.h but don't need any of its functions
* Remove trailing blank linesDaniel P. Berrange2012-01-1330-30/+0
| | | | Remove any blank lines at the end of all source files
* Remove 'the the' typosDaniel P. Berrange2012-01-132-2/+2
|
* Remove unused assert.h includeDaniel P. Berrange2012-01-131-1/+0
| | | | The assert.h include was never used in any code
* Rewrite code to avoid triggering warning about casting param to free()Daniel P. Berrange2012-01-131-1/+2
| | | | | | | | Since free() takes a void* parameters do not need to be cast. The existing code here is actally fine, but it trips up the syntax-check rule, so tweak it to an equivalent construct which passes the syntax check
* Remove useless if() before free()Daniel P. Berrange2012-01-134-11/+4
| | | | | The free() function allows NULL to be passed in, so any code which puts a if() before free() is wasting time
* Death to all TABsDaniel P. Berrange2012-01-133-3/+3
| | | | | | Source files should all use spaces instead of tabs for indentation. Update the few files not already in compliance
* smartcard handling: Fix compilation when ASSERT-s are turned onHans de Goede2012-01-131-1/+1
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* server: add support for SPICE_COMMON_CAP_MINI_HEADERYonit Halperin2012-01-124-127/+378
| | | | | | | | | Support for a header without a serial and without sub list. red_channel: Support the two types of headers. Keep a consistent consecutive messages serial. red_worker: use urgent marshaller instead of sub list. snd_worker: Sound channels need special support since they still don't use red_channel for sending & receiving.
* server: Limit the access to SpiceDataHeader of messages - only via red_channel.Yonit Halperin2012-01-128-71/+99
|
* server/red_worker: pass remote caps to display/cursor red_channel_client'sYonit Halperin2012-01-123-12/+68
|
* server/red_channel: introduce urgent marshallerYonit Halperin2012-01-122-6/+85
| | | | | | | | | | When red_channel::red_channel_client_begin_send_message is called, the message that is pending in the urgent marshaller will be sent before the one in the main channel. The urgent marshaller should be used if in the middle of marshalling one message, you find out you need to send another message before. This functionality is equivalent to the sub_list messages. It will replace them in the following patches, when sub_list is removed from Spice data header.
* Do not assume that SPICE is using a TCP socketDaniel P. Berrange2012-01-091-2/+4
| | | | | | | | | | If setting the TCP_NODELAY socket option fails with ENOTSUP, then don't treat this is a fatal error. SPICE is likely just running over a UNIX socket instead. * server/inputs_channel.c: Ignore TCP_NODELAY socket opt fails Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Allow auth to be skipped when attaching to pre-accepted clientsDaniel P. Berrange2012-01-092-10/+15
| | | | | | | | | | | When an applications passes in a pre-accepted socket for a client, they may well have already performed suitable authentication out of band. They should thus have the option to request that any spice authentication is skipped. * server/reds.c, spice.h: Add flag for skipping auth Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add APIs for injecting a client connection socketDaniel P. Berrange2012-01-093-4/+33
| | | | | | | | | | | Allow applications to pass a pre-accepted client socket file descriptor in. The new APIs are spice_server_add_ssl_client and spice_server_add_client * server/reds.c: Implement new APIs * server/spice.h: Define new APIs Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Move SSL setup out of reds_accept_ssl_connectionDaniel P. Berrange2012-01-091-10/+21
| | | | | | | | | | | To allow setup of an SSL client, from a passed in client socket, move all the SSL client initialization code out of reds_accept_ssl_connection and into a new method called reds_init_client_ssl_connection * server/reds.c: Introduce reds_init_client_ssl_connection Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Rename __reds_accept_connection into reds_init_client_connectionDaniel P. Berrange2012-01-091-13/+18
| | | | | | | | | | | | Remove the accept() call from __reds_accept_connection and rename it to reds_init_client_connection. The caller is now responsible for accepting the new socket. The method reds_init_client_connection merely initializes it for usage. * server/reds.c: Add reds_init_client_connection Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Merge reds_accept_connection into reds_acceptDaniel P. Berrange2012-01-091-18/+8
| | | | | | | | | | Neither reds_accept_connection or reds_accept are very long, so the split is pointless & increases code size for no gain. Merge them together to reduce code size * server/reds.c: Merge reds_accept_connection into reds_accept Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* spicevmc: Set sockopt nodelay for usbredir channelsHans de Goede2011-12-221-0/+15
| | | | | | We want as little latency as possible with usb channels. Signed-off-by: Hans de goede <hdegoede@redhat.com>
* server: don't reset the display channel when disconnecting all its clients ↵Yonit Halperin2011-12-221-12/+6
| | | | | | | | | | | | ,FDBZ #43977 The display channel was unnecessarily set to NULL when we disconnect all the clients (on flush display commands timeout). As a result, we recreated the display channel when a new client was connected. The display channel was created with default red_channel.client_cbs, while its correct client_cbs are the ones that are set by the red_dispatcher when it creates the first display_channel. This fix enforces a single creation of the display channel (per qxl), via the red_dispatcher.
* spicevmc: Fix assert when still connected on session disconnect (fdo#43903)Hans de Goede2011-12-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Currently when the main channel disconnects while a spicevmc channel (such as a usbredir channel) is still connected, qemu will abort with the following message: ring_remove: ASSERT item->next != NULL && item->prev != NULL failed This is caused by red_client_destroy() first calling: rcc->channel->client_cbs.disconnect(rcc); And then calling: red_channel_client_destroy(rcc); For each channel. This is fine, but the spicevmc disconnect code does a red_channel_client_destroy(rcc) itself since as usb devices are added / removed, the channels carrying their traffic get connected / disconnected and they get re-used for new devices, which won't work if the old channel is still there when the new connection comes in. This patch fixes the double destroy when there are still spicevmc channels connected by not doing the red_channel_client_destroy from the spicevmc disconnect code when not just the channel, but the entire client is disconnecting. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* server/red_parse_qxl.h: License should be LGPLv2+ rather then GPLv2+Hans de Goede2011-12-152-12/+12
| | | | | | | Also fixup the header of server/red_parse_qxl.c, which still contained some GPL (program rather then library) text in its header. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* server: Move $(Z_LIBS) from INCLUDES to LIBADD in Makefile.amJürg Billeter2011-11-281-1/+1
| | | | | | This fixes undefined references to deflate* when building tests. Signed-off-by: Jürg Billeter <j@bitron.ch>
* server/mjpeg_encoder: use size_t * consistentlyAlon Levy2011-11-101-2/+2
| | | | fix another 64 bit-ism. unsigned long != size_t in general.
* 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/spice-server.syms: fix 0.8 compatibilityAlon Levy2011-11-081-2/+6
| | | | | | | spice_server_migrate_connect is in 0.8.3 in the released 0.8 branch, and so should not be changed in 0.10. This doesn't break the 0.9.1 release which didn't contain this symbol at all, only 0.9.2 release that hopefully no one actually packaged.
* server/red_worker: reuse dispatcherAlon Levy2011-11-084-547/+997
| | | | | | | | | | | | | | | | | | | | | | This patch reuses Dispatcher in RedDispatcher. It adds two helpers to red_worker to keep RedWorker opaque to the outside. The dispatcher is abused in three places that use the underlying socket directly: once sending a READY after red_init completes once for each channel creation, replying with the RedChannel instance for cursor and display. FDO Bugzilla: 42463 rfc->v1: * move callbacks to red_worker.c including registration (Yonit) * rename dispatcher to red_dispatcher in red_worker.c and red_dispatcher.c * add accessor red_dispatcher_get_dispatcher * s/dispatcher_handle_recv/dispatcher_handle_recv_read/ and change sig to just Dispatcher *dispatcher (was the SpiceCoreInterface one) * remove SpiceCoreInterface parameter from dispatcher_init (Yonit) * main_dispatcher needed it for channel_event so it has it in struct MainDispatcher * add dispatcher_get_recv_fd for red_worker
* server/dispatcher: add dispatcher_register_async_done_callbackAlon Levy2011-11-082-2/+29
|
* introduce DISPATCHER_{NONE,ACK,ASYNC}Alon Levy2011-11-082-7/+18
|
* server: introduce dispatcherAlon Levy2011-11-084-75/+358
| | | | | | | | | | | | | | | | | | | | | | | | used for main_dispatcher only in this patch. Dispatcher is meant to be used for Main<->any low frequency messages. It's interface is meant to include the red_dispatcher usage: fixed size messages per message type some messages require an ack Some methods are added to be used by RedDispatcher later: dispatcher_handle_read - to be called directly by RedDispatcher epoll based loop dispatcher_set_opaque - to be set from red_worker pthread dispatcher_init - allow NULL core as used by red_worker Read and Write behavior: Sender: blocking write, blocking read for ack (if any). Reader: poll for any data, if such then blocking read for a message_type and following message. repeat until poll returns with no pending data to read. FDO Bugzilla: 42463
* server/red_dispatcher: remove semicolon from DBG_ASYNCAlon Levy2011-11-071-1/+1
|
* server: add prefix argument to red_printf_debugAlon Levy2011-11-073-14/+23
| | | | | printed before function name. No central location for prefixes. Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
* server/red_dispatcher: support concurrent asyncsAlon Levy2011-11-073-65/+61
| | | | | | | | | | | | | | | This is part of the dispatcher update, extracting the dispatcher routine from red_dispatcher and main_dispatcher into dispatcher. Supporting multiple async operations will make it natural to support async monitor commands and async guest io requests that could overlap in time. Use a Ring for AsyncCommands. Free Desktop Bugzilla: 42463 Related FD: 41622
* Release 0.9.2Yonit Halperin2011-11-021-0/+1
|
* server: turn spice_server_migrate_start into a valid callYonit Halperin2011-11-021-7/+1
| | | | | | We will add a qemu call to spice_server_migrate_start when migration starts. For now, it does nothing, but we may need this notification in the future. (cherry picked from commit b8213167717979e6f2fb52646e43eb458634e6a1 branch 0.8)
* server: handling semi-seamless migration in the target sideYonit Halperin2011-11-026-46/+248
| | | | | | | | | | (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: move the linking of channels to a separate routineYonit Halperin2011-11-021-17/+28
|
* server: handle spice_server_migrate_endYonit Halperin2011-11-024-108/+117
| | | | | | | | | | | | | | | | 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-025-149/+172
| | | | | | | | | | | | | | | 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-022-0/+33
| | | | | | | | (cherry picked from commit 3ac0075cdac8fa42de47a7882022795e96cb1fee branch 0.8) Conflicts: server/reds.h
* server/spice.h: semi-seamless migration interface, RHBZ #738266Yonit Halperin2011-11-023-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. (cherry picked from commit 6e56bea67c5648b0c81990171d4bc0cf1a402043 branch 0.8) Conflicts: server/spice.h
* server: set & test channel capabilities in red_channelYonit Halperin2011-11-0211-181/+226
| | | | | | | 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.
* [0.8 branch] server: add main_dispatcherAlon Levy2011-10-314-1/+159
| | | | | | | | | | | | | | | | | | | | | | | 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
* server/red_worker: fix placing of ↵Yonit Halperin2011-10-181-4/+6
| | | | | | | ASSERT(red_channel_client_no_item_being_sent) (fdbz #41523) Call ASSERT(red_channel_client_no_item_being_sent) only if red_wait_outgoing_item/s did not timeout.
* replace warning with comment in glz_usr_free_imageChristophe Fergeau2011-09-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running some xinerama tests, I got several glz_usr_free_image: error messages. Looking at the code, this error is reported when this function is called from a different DisplayChannelClient than the one which created the glz compressed image. When this happens, the backtrace is at glz_encoder_dictionary.c:362 0x7fff940b6670) at glz_encoder_dictionary.c:449 image_type=LZ_IMAGE_TYPE_RGB32, image_width=512, image_height=256, image_stride=2048, first_lines=0x0, num_first_lines=0, usr_image_context=0x7fff7420da40, image_head_dist=0x7fff9b2a3194) at glz_encoder_dictionary.c:570 top_down=4, lines=0x0, num_lines=0, stride=2048, io_ptr=0x7fff740ea7c0 " ZL", num_io_bytes=65536, usr_context= 0x7fff7420da40, o_enc_dict_context=0x7fff7420da60) at glz_encoder.c:255 drawable=0x7fff9b46bc08, o_comp_data=0x7fff9b2a3350) at red_worker.c:5753 0x7fff9b46bc08, can_lossy=0, o_comp_data=0x7fff9b2a3350) at red_worker.c:6211 0x7fff9b46bc08, can_lossy=0) at red_worker.c:6344 0x7fff74085c50, dpi=0x7fff7445b890, src_allowed_lossy=0) at red_worker.c:7046 0x7fff7445b890) at red_worker.c:7720 at red_worker.c:7964 at red_worker.c:8431 Since the glz dictionary is shared between all the DisplayChannelClient instances that belong to the same client, it can happen that the glz dictionary code decides to free an image from one thread while it was added from another thread (thread == DisplayChannelClient), so the error message that is printed is not an actual error. This commit removes this message and adds a comment explaining what's going on.
* server: fix function prototypesChristophe Fergeau2011-09-0513-39/+37
| | | | | | | | 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: init all fields on SpiceMsgDisplayStreamCreateChristophe Fergeau2011-09-011-0/+2
| | | | | | | | | red_display_marshall_stream_start initializes a SpiceMsgDisplayStreamCreate structure before marshalling it and sending it on the wire. However, it never fills SpiceMsgDisplayStreamCreate::stamp which then causes a complaint from valgrind. This patch sets this value to 0, it's not used by the client so the value shouldn't matter.