Avoid using global variable for channel IDs

Enterprise / Virtualization / SPICE - Frediano Ziglio [redhat.com] - 2 September 2017 03:20 EDT

This patch allocates VMC IDs by finding the first ID not used instead of using a global variable and incrementing the value for each channel created. This solves some potential issues:- remove the global state potentially making possible to use multiple SpiceServer on the same process;- don't potentially overflow the variable. This can happen if channels are allocated/deallocated multiple times (currently not done by Qemu).

dd871c0 Avoid using global variable for channel IDs
server/reds.c | 32 ++++++++++++++++++++++++++++++++
server/reds.h | 1 +
server/spicevmc.c | 10 ++++++++--
3 files changed, 41 insertions(+), 2 deletions(-)

Upstream: cgit.freedesktop.org

  • Share