"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/daemonsitter.cpp" between
muscle8.20.zip and muscle8.30.zip

About: MUSCLE (Multi User Server Client Linking Environment) is a messaging server and networking API. The included server program ("muscled") lets its clients message each other, and/or store information in its serverside hierarchical database.

daemonsitter.cpp  (muscle8.20):daemonsitter.cpp  (muscle8.30)
skipping to change at line 115 skipping to change at line 115
private: private:
const String _processLabel; const String _processLabel;
const Queue<String> _childArgv; const Queue<String> _childArgv;
}; };
// This class listens to the stdin file handle. It is used in both the // This class listens to the stdin file handle. It is used in both the
// parent/daemonsitter process and in the child processes. // parent/daemonsitter process and in the child processes.
class StdinSession : public AbstractReflectSession class StdinSession : public AbstractReflectSession
{ {
public: public:
StdinSession(const String & processLabel) : _processLabel(processLabel) {/* e mpty */} explicit StdinSession(const String & processLabel) : _processLabel(processLab el) {/* empty */}
/** This is overridden to force CreateDataIO() to be called, even though no S ocket was passed in to AddNewSession() */ /** This is overridden to force CreateDataIO() to be called, even though no S ocket was passed in to AddNewSession() */
virtual ConstSocketRef CreateDefaultSocket() {return GetInvalidSocket();} virtual ConstSocketRef CreateDefaultSocket() {return GetInvalidSocket();}
virtual DataIORef CreateDataIO(const ConstSocketRef &) virtual DataIORef CreateDataIO(const ConstSocketRef &)
{ {
DataIO * dio = newnothrow StdinDataIO(false); DataIO * dio = newnothrow StdinDataIO(false);
if (dio == NULL) MWARN_OUT_OF_MEMORY; if (dio == NULL) MWARN_OUT_OF_MEMORY;
return DataIORef(dio); return DataIORef(dio);
} }
skipping to change at line 227 skipping to change at line 227
const String _processLabel; // human-readable description of our own process const String _processLabel; // human-readable description of our own process
}; };
// Our dummy child-process program. It just listens for commands from the paren t process (sent to it from stdin) // Our dummy child-process program. It just listens for commands from the paren t process (sent to it from stdin)
static int DoChildProcess(const String & label, int /*argc*/, char ** /*argv*/) static int DoChildProcess(const String & label, int /*argc*/, char ** /*argv*/)
{ {
ReflectServer server; ReflectServer server;
status_t ret; status_t ret;
StdinSession stdinSession(label); StdinSession stdinSession(label);
if (server.AddNewSession(AbstractReflectSessionRef(&stdinSession, false)).IsO K(ret)) if (server.AddNewSession(DummyAbstractReflectSessionRef(stdinSession)).IsOK(r et))
{ {
LogTime(MUSCLE_LOG_INFO, "Child Process [%s] is running and listening to s tdin.\n", label()); LogTime(MUSCLE_LOG_INFO, "Child Process [%s] is running and listening to s tdin.\n", label());
if (server.ServerProcessLoop().IsOK()) LogTime(MUSCLE_LOG_INFO, "Child Pr ocess [%s] event-loop finished.\n", label()); if (server.ServerProcessLoop().IsOK()) LogTime(MUSCLE_LOG_INFO, "Child Pr ocess [%s] event-loop finished.\n", label());
else LogTime(MUSCLE_LOG_ERROR, "Child Pr ocess [%s] event-loop exited with an error [%s].\n", label(), ret()); else LogTime(MUSCLE_LOG_ERROR, "Child Pr ocess [%s] event-loop exited with an error [%s].\n", label(), ret());
} }
else LogTime(MUSCLE_LOG_ERROR, "DoChildProcess: Couldn't add stdin session t o ReflectServer! [%s]\n", ret()); else LogTime(MUSCLE_LOG_ERROR, "DoChildProcess: Couldn't add stdin session t o ReflectServer! [%s]\n", ret());
server.Cleanup(); server.Cleanup();
return 0; return 0;
skipping to change at line 271 skipping to change at line 271
LogTime(MUSCLE_LOG_INFO, "kill sub3\n"); LogTime(MUSCLE_LOG_INFO, "kill sub3\n");
LogTime(MUSCLE_LOG_INFO, "echo hello\n"); LogTime(MUSCLE_LOG_INFO, "echo hello\n");
LogTime(MUSCLE_LOG_INFO, "die\n"); LogTime(MUSCLE_LOG_INFO, "die\n");
LogTime(MUSCLE_LOG_INFO, "\n"); LogTime(MUSCLE_LOG_INFO, "\n");
// Parent process: watch stdin (so the user can type in commands) and launch some child processes // Parent process: watch stdin (so the user can type in commands) and launch some child processes
StdinSession stdinSession("launcher"); StdinSession stdinSession("launcher");
status_t ret; status_t ret;
ReflectServer server; ReflectServer server;
if (server.AddNewSession(AbstractReflectSessionRef(&stdinSession, false)).IsO K()) if (server.AddNewSession(DummyAbstractReflectSessionRef(stdinSession)).IsOK() )
{ {
// Also add some dummy child processes that we will manage and restart // Also add some dummy child processes that we will manage and restart
for (uint32 i=0; i<5; i++) for (uint32 i=0; i<5; i++)
{ {
const String childProcessLabel = String("sub%1").Arg(i); const String childProcessLabel = String("sub%1").Arg(i);
Queue<String> childArgv; Queue<String> childArgv;
(void) childArgv.AddTail(argv[0]); (void) childArgv.AddTail(argv[0]);
(void) childArgv.AddTail(String("subprocess=%1").Arg(childProcessLabel) ); (void) childArgv.AddTail(String("subprocess=%1").Arg(childProcessLabel) );
AbstractReflectSessionRef childSessionRef(newnothrow ChildProcessSessio n(childProcessLabel, childArgv)); AbstractReflectSessionRef childSessionRef(newnothrow ChildProcessSessio n(childProcessLabel, childArgv));
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)