This patch use old code to implement timer events.
The new version use some function from GLib 2.34 however some systems
(like RHEL 6) have former GLib version (RHEL 6 has GLib 2.28 installed)
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Since this is public API, we can't easily change the signature of the
function to take a RedsState argument, so instead we apply a hack and
store the reds argument inside the device state struct when the
interface is added, and retrieve it for use later when it is removed.
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Send the fd associated to the last message sent.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
The default rule being "all", it builds noinst_PROGRAMS but not
check_PROGRAMS. Let's build all the tests by default.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Was used to just assure there was at least one renderer in the list.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Use the glib mainloop instead of writing our own. The glib loop is both
cleaner to use and is more extensible. It is also very mature and
reduces the maintenance burden on the spice server.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Make the RedsState object own an InputsChannel object rather than
having a global inputs channel. This means changing a lot of
inputs-related API to take an InputsChannel* argument and moving the
keyboard, mouse, and tablet objects into the InputsChannel object.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
red_channel_max_pipe_size returns 0 if no client (channel disconnected)
no need to check if cursor_channel/display_channel are NULL or
connected.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
Calling cursor_channel_disconnect does not free cursor_display
so this causes a leak.
Is the only code where this pointer is reset preventing any
further cursor channel connection. If a client is lazy reading
cursor data during the flush connection is closed and further clients
won't be able to use the cursor.
This also prevents future use of a NULL pointer.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
Use a custom GSource.
This to avoid having to allocate a timer all the time we add one.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Send wakeups only when a command is available.
This emulate better what a guest driver should do (append the command
to the ring and then signal).
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
This increase code reuse and make Glib integration more straight forward.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This is mainly question of style.
Instead of repeating same conversion use the variable we set at the
beginning of the function.
Note also that I used same name to make the two functions more
similar.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
All checks for full channel pipes have to be consistents
so there is no point in passing as a parameter.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
If the creator was not able to produce the item, no need to call
pipe_add().
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat>
The replay file should start with a header such as
SPICE_REPLAY 1
Instead of soldiering on if we don't encounter this header, print a
warning and return NULL. Also exit with a failure if spice_replay_new()
returns a NULL object in main.
Acked-by: Pavel Grunt <pgrunt@redhat.com>
In preparation for getting rid of the global 'reds' variable, we need to
pass the RedsState variable to all functions where it is needed. For now
the callers just pass in the global reds variable.
Functions changed:
- reds_mig_fill_wait_disconnect;
- reds_mig_cleanup_wait_disconnect;
- reds_mig_remove_wait_disconnect_client;
- reds_migrate_channels_seamless;
- reds_mig_finished;
- reds_mig_switch;
- reds_enable_mm_time;
- reds_disable_mm_time;
- attach_to_red_agent;
- reds_char_device_add_state;
- reds_char_device_remove_state;
- reds_on_char_device_state_destroy;
- spice_server_char_device_remove_interface;
- migrate_timeout.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Since SpiceCoreInterfaceInternal is a private data structure, we can
extend it as we see fit without breaking ABI. In particular, adding a
GMainContext member to it allows us to remove the need for
the event loop template which is currently included in the
basic_event_loop.c test file.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
They call the functions provided by event_loop_core, but with a NULL
SpiceCoreInterfaceInternal parameter. It makes more sense to pass
event_loop_core rather than NULL.
This will allow to pass the GMainContext to be used through
SpiceCoreInterfaceInternal rather than through a template parameter.
Acked-by: Frediano Ziglio <fziglio@redhat.com>