From 4fefe352c9d93b0a51ed2e7c34f47a0d951413db Mon Sep 17 00:00:00 2001 From: Nito Martinez Date: Fri, 15 May 2015 15:20:52 +0200 Subject: This patch allows to cleanup the nxcomp resources to allow for a second connection inside the same process, instead of a new process as is the nxproxy case. This involves creating a new API call void NXTransCleanupForReconnect(void); which basically cleans up the global state for the connection but does not exit the process. Background ========== This is needed for the IOS platform, where the nxproxy model of forking does not work. Also NX handles most of the errors with an "exit" call which in IOS cannot be easily handled. --- nxcomp/Loop.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'nxcomp/Loop.cpp') diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp index 7bc154f36..f25aed353 100644 --- a/nxcomp/Loop.cpp +++ b/nxcomp/Loop.cpp @@ -1311,6 +1311,11 @@ void NXTransCleanup() HandleCleanup(); } +void NXTransCleanupForReconnect() +{ + HandleCleanupForReconnect(); +} + // // Check the parameters for subsequent // initialization of the NX transport. @@ -4873,6 +4878,28 @@ int StartKeeper() return 1; } +void HandleCleanupForReconnect() +{ + #ifdef TEST + *logofs << "Loop: Going to clean up system resources for Reconnect " + << "in process '" << getpid() << "'.\n" + << logofs_flush; + #endif + handleTerminatedInLoop(); + DisableSignals(); + if (control) + CleanupChildren(); + CleanupListeners(); + CleanupSockets(); + CleanupKeeper(); + CleanupStreams(); + CleanupLocal(); + CleanupGlobal(); + RestoreSignals(); + ServerCache::lastInitReply.set(0,NULL); + ServerCache::lastKeymap.set(0,NULL); + ServerCache::getKeyboardMappingLastMap.set(0,NULL); +} void HandleCleanup(int code) { #ifdef TEST -- cgit v1.2.3