Communication with the client is done differently on Windows and Linux (named pipe VS unix socket), so move this platform-specific setup to a distinct method. --- SpiceXPI/src/plugin/controller-unix.cpp | 15 +++++++++++---- SpiceXPI/src/plugin/controller.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/SpiceXPI/src/plugin/controller-unix.cpp b/SpiceXPI/src/plugin/controller-unix.cpp index ed4e174..338f1a8 100644 --- a/SpiceXPI/src/plugin/controller-unix.cpp +++ b/SpiceXPI/src/plugin/controller-unix.cpp @@ -138,6 +138,16 @@ int SpiceController::Connect(const int nRetries) return rc; } +void SpiceController::SetupControllerPipe(GStrv &env) +{ + std::string socket_file(this->m_tmp_dir); + socket_file += "/spice-xpi"; + + this->SetFilename(socket_file); + + env = g_environ_setenv(env, "SPICE_XPI_SOCKET", socket_file.c_str(), TRUE); +} + void SpiceController::Disconnect() { // close the socket @@ -205,12 +215,9 @@ gpointer SpiceController::ClientThread(gpointer data) gboolean spawned; GError *error = NULL; - std::string socket_file(fake_this->m_tmp_dir); - socket_file += "/spice-xpi"; - fake_this->SetFilename(socket_file); + fake_this->SetupControllerPipe(env); - env = g_environ_setenv(env, "SPICE_XPI_SOCKET", socket_file.c_str(), TRUE); if (!fake_this->m_proxy.empty()) env = g_environ_setenv(env, "SPICE_PROXY", fake_this->m_proxy.c_str(), TRUE); diff --git a/SpiceXPI/src/plugin/controller.h b/SpiceXPI/src/plugin/controller.h index e63e121..e19187c 100644 --- a/SpiceXPI/src/plugin/controller.h +++ b/SpiceXPI/src/plugin/controller.h @@ -58,6 +58,7 @@ */ #include <glib.h> +#include <glib-object.h> /* for GStrv */ #include <string> extern "C" { # include <stdint.h> @@ -87,6 +88,7 @@ public: private: int Connect(); void WaitForPid(GPid pid); + void SetupControllerPipe(GStrv &env); static void ChildExited(GPid pid, gint status, gpointer user_data); static gpointer ClientThread(gpointer data); -- 1.8.1.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel