Commit Graph

19 Commits

Author SHA1 Message Date
Uri Lublin
d6092f11b6 syntax-check: remove trailing whitespaces
Only whitespace changes in this commit.
2013-07-16 23:37:29 +03:00
Uri Lublin
d45f3bdc6b syntax-check: make sure config.h is the first included .h file 2013-07-16 23:37:29 +03:00
Uri Lublin
bc77805b5f syntax-check: fix no-newline or empty line at EOF 2013-07-16 23:37:29 +03:00
Hans de Goede
baa7cab700 char_device: Don't set active when stopped and don't access dev after unref
2 closely related changes in one:
1) When leaving the read or write loop because the chardev has been stopped
active should not be updated. It has been set to FALSE by
spice_char_device_stop and should stay FALSE
2) The updating of dev->active should be done *before* unref-ing dev

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-03-29 10:07:26 +01:00
Hans de Goede
3d775594b5 char_device: Don't set the write-retry timer when not running
The write-retry timer should not be set when we're leaving
spice_char_device_write_to_device because the char-dev has been stopped.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-03-29 10:05:24 +01:00
Hans de Goede
e3c6f793f7 char_device: Properly update buffer status when leaving the write loop on stop
Before this patch the write-loop in spice_char_device_write_to_device would
break on running becoming 0, after having written some data, without updating
the buffer status, causing the same data to be written *again* when started.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-03-29 10:05:11 +01:00
Hans de Goede
4476c99452 char_device: Add spice_char_device_write_buffer_get_server_no_token()
To allow the server to send agent messages without needing to wait for a
self-token. IE for sending VD_AGENT_CLIENT_DISCONNECTED messages.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-03-07 11:52:23 +01:00
Hans de Goede
b42f2e1fc9 Silence __spice_char_device_write_buffer_get: internal buf is not available
These messages are printed when the server tries to push a mouse event to
the agent before the previous one has been flushed. This is a normal condition
(which gets tracked by the reds->pending_mouse_event boolean), and as such
it should *not* trigger the printing of error messages.

I've seen these messages occasionally before, but with agent file-xfer they
are trivial to trigger, simply send a large file to the agent and while it
is transferring move the mouse over the client window. Note that due to the
client tokens not allowing the client to completely saturate the agent
channel mouse events do still get send to the agent, just with a slightly
larger interval. So everything is working as designed and this spice_printerr
is just leading to people chasing ghosts.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-03-04 16:35:54 +01:00
Yonit Halperin
0ca75b0235 char_device.c: when the state is destroyed, also free the buffer that is being written to the device 2012-11-26 11:08:10 -05:00
Yonit Halperin
d6b3f73102 char_device.c: add ref count for write-to-device buffers
The ref count is used in order to keep buffers that were in the write
queue and now are part of migration data, in case the char_device state
is destroyed before we complete sending the migration data.
2012-11-26 11:08:08 -05:00
Yonit Halperin
4cd4e7cf19 char_device.c: fix call to spice_marshaller_add_ref with memory on stack
rhbz#862352
2012-11-21 09:19:46 -05:00
Yonit Halperin
9c6a49c364 char_device: don't connect a migrated client if the state of the device might have changed since it was created
If reading/writing from the device have occured before migration data
has arrived, the migration data might no longer be relvant, and we
disconnect the client.
2012-08-27 09:13:08 +03:00
Yonit Halperin
99ea64ac5a char device migration: restore state at destination from migration data 2012-08-27 09:13:02 +03:00
Yonit Halperin
cb767a83fd char device migration: don't read or write from/to the device while waiting for migraion data 2012-08-27 09:13:02 +03:00
Yonit Halperin
b0264a5e37 char device migration: marshall migration data 2012-08-27 09:13:02 +03:00
Yonit Halperin
520e2cd4f4 char_device: variable token price for write buffers
When restoring migration data, we also restore data that is addressed to
the device, and that might have been originated from more than 1
message. When the write buffer that is assoicated with this data is
released, we need to free all the relevant tokens.
2012-08-27 09:13:01 +03:00
Yonit Halperin
11033ca5dc reds: add tracking for char devices
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.
2012-08-27 09:04:51 +03:00
Yonit Halperin
bf91bdce5c char_device: move SpiceCharDeviceState from the header
In addition, I also removed the no longer used wakeup callback
2012-07-03 14:13:43 +03:00
Yonit Halperin
50e3af6a99 char_device: Introducing shared flow control code for char devices.
SpiceCharDeviceState manages the (1) write-to-device queue
(2) wakeup and reading from the device (3) client tokens (4)
sending messages from the device to the client/s, considering the
available tokens.
SpiceCharDeviceState can be also stopped and started. When the device
is stopped, no reading or writing is done from/to the device. Messages
addressed from the client to the device are being queued.
Later, an api for stop/start will be added to spice.h and it should
be called from qemu.

This patch does not yet remove the wakeup callback from
SpiceCharDeviceState, but once all the char devices (agent/spicevmc/smartcard)
code will switch to the new implementation, SpiceCharDeviceState
will be moved to the c file and its reference to the wakeup callback will be removed.
2012-07-03 14:13:41 +03:00