diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2014-06-30 14:53:09 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2014-06-30 14:53:09 +0200 |
commit | 77c3e15506839c9c7c2a6e8c7582da49b33507b8 (patch) | |
tree | 0825df3613dd960b5b2724212aaf3511923b50f6 /debian/patches/210_nxagent_save_session_state.full.patch | |
parent | 035de8281a0455d0bf98fdd786e492587ae88e31 (diff) | |
download | nx-libs-77c3e15506839c9c7c2a6e8c7582da49b33507b8.tar.gz nx-libs-77c3e15506839c9c7c2a6e8c7582da49b33507b8.tar.bz2 nx-libs-77c3e15506839c9c7c2a6e8c7582da49b33507b8.zip |
Split up patch 210 (for correct creation nx-libs, nx-libs-lite tarballs):
* Split up patch 210 (for correct creation nx-libs, nx-libs-lite tarballs):
+ 210_nxagent_save_session_state.full.patch
+ 210_nxcomp_save_session_state.full+lite.patch
Diffstat (limited to 'debian/patches/210_nxagent_save_session_state.full.patch')
-rw-r--r-- | debian/patches/210_nxagent_save_session_state.full.patch | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/debian/patches/210_nxagent_save_session_state.full.patch b/debian/patches/210_nxagent_save_session_state.full.patch new file mode 100644 index 000000000..223d0bc7a --- /dev/null +++ b/debian/patches/210_nxagent_save_session_state.full.patch @@ -0,0 +1,176 @@ +Description: Save session state in file +Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> + +--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c ++++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c +@@ -60,6 +60,7 @@ + #endif + #include "Handlers.h" + #include "Error.h" ++#include "Reconnect.h" + + /* + * NX includes and definitions. +@@ -1090,6 +1091,11 @@ + + return; + } ++ else if (!strcmp(name, "state")) ++ { ++ setStatePath(value); ++ return; ++ } + else if (!strcmp(name, "fullscreen")) + { + if (nxagentReconnectTrap == True) +@@ -1369,6 +1375,11 @@ + validateString(nxagentOptionFile)); + #endif + ++ /* ++ * Init statePath ++ */ ++ setStatePath(""); ++ + if (nxagentOptionFile == NULL) + { + return; +--- a/nx-X11/programs/Xserver/hw/nxagent/Init.c ++++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c +@@ -63,7 +63,7 @@ + + #include "NX.h" + #include "NXlib.h" +- ++#include "Reconnect.h" + /* + * Set here the required log level. + */ +@@ -233,6 +233,7 @@ + fprintf(stderr, "Info: Agent running with pid '%d'.\n", getpid()); + + fprintf(stderr, "Session: Starting session at '%s'.\n", GetTimeAsString()); ++ saveAgentState("STARTING"); + } + + /* +--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c ++++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +@@ -118,6 +118,33 @@ + + static enum RECONNECTION_STEP failedStep; + ++#include <limits.h> ++ ++/* ++ * Path of state File ++ */ ++char stateFile[PATH_MAX]; ++ ++ ++void setStatePath(char* path) ++{ ++ strncpy(stateFile, path, PATH_MAX-1); ++} ++ ++void saveAgentState(char* state) ++{ ++ FILE* fptr; ++ if(strlen(stateFile)) ++ { ++ fptr=fopen(stateFile, "w"); ++ if(!fptr) ++ return; ++ fprintf(fptr,"%s", state); ++ fclose(fptr); ++ } ++} ++ ++ + int nxagentHandleConnectionStates(void) + { + #ifdef TEST +@@ -211,6 +238,7 @@ + fprintf(stderr, "Session: Display failure detected at '%s'.\n", GetTimeAsString()); + + fprintf(stderr, "Session: Suspending session at '%s'.\n", GetTimeAsString()); ++ saveAgentState("SUSPENDING"); + } + + nxagentDisconnectSession(); +@@ -265,6 +293,7 @@ + fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString()); + #endif + } ++ saveAgentState("SUSPENDED"); + + nxagentResetDisplayHandlers(); + +@@ -622,6 +651,7 @@ + #else + fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString()); + #endif ++ saveAgentState("RUNNING"); + + nxagentRemoveSplashWindow(NULL); + +@@ -785,12 +815,14 @@ + if (nxagentSessionState == SESSION_GOING_DOWN) + { + fprintf(stderr, "Session: Suspending session at '%s'.\n", GetTimeAsString()); ++ saveAgentState("SUSPENDING"); + + nxagentDisconnectSession(); + } + else if (nxagentSessionState == SESSION_GOING_UP) + { + fprintf(stderr, "Session: Resuming session at '%s'.\n", GetTimeAsString()); ++ saveAgentState("RESUMING"); + + if (nxagentReconnectSession()) + { +@@ -803,6 +835,7 @@ + fprintf(stderr, "Session: Display failure detected at '%s'.\n", GetTimeAsString()); + + fprintf(stderr, "Session: Suspending session at '%s'.\n", GetTimeAsString()); ++ saveAgentState("SUSPENDING"); + + nxagentDisconnectSession(); + } +--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.h ++++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.h +@@ -34,6 +34,8 @@ + Bool nxagentReconnectSession(void); + int nxagentHandleConnectionStates(void); + void nxagentHandleConnectionChanges(void); ++void setStatePath(char*); ++void saveAgentState(char*); + + enum SESSION_STATE + { +--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c ++++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c +@@ -609,6 +609,7 @@ + #endif + + nxagentSessionState = SESSION_UP; ++ saveAgentState("RUNNING"); + } + + #ifdef BLOCKS +@@ -823,6 +824,7 @@ + */ + + fprintf(stderr, "Session: Terminating session at '%s'.\n", GetTimeAsString()); ++ saveAgentState("TERMINATING"); + + nxagentWaitDisplay(); + +@@ -833,6 +835,7 @@ + { + NXShadowDestroy(); + } ++ saveAgentState("TERMINATED"); + + KillAllClients(); + DEALLOCATE_LOCAL(clientReady); |