"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/testchildprocess.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.

testchildprocess.cpp  (muscle8.20):testchildprocess.cpp  (muscle8.30)
skipping to change at line 28 skipping to change at line 28
{ {
LogTime(MUSCLE_LOG_INFO, "Usage: ./testchildprocess <count> <cmd> [args]\n") ; LogTime(MUSCLE_LOG_INFO, "Usage: ./testchildprocess <count> <cmd> [args]\n") ;
exit(10); exit(10);
} }
// This class is here only to verify that we do something reasonable // This class is here only to verify that we do something reasonable
// when ChildProcessReadyToRun() returns an error // when ChildProcessReadyToRun() returns an error
class AbortOnTakeoffChildProcessDataIO : public ChildProcessDataIO class AbortOnTakeoffChildProcessDataIO : public ChildProcessDataIO
{ {
public: public:
AbortOnTakeoffChildProcessDataIO(bool blocking) : ChildProcessDataIO(blocking ) {/* empty */} explicit AbortOnTakeoffChildProcessDataIO(bool blocking) : ChildProcessDataIO (blocking) {/* empty */}
virtual status_t ChildProcessReadyToRun() virtual status_t ChildProcessReadyToRun()
{ {
(void) ChildProcessDataIO::ChildProcessReadyToRun(); (void) ChildProcessDataIO::ChildProcessReadyToRun();
printf("AbortOnTakeoffChildProcessDataIO::ChildProcessReadyToRun() deliber ately returning B_ERROR for testing purposes.\n"); printf("AbortOnTakeoffChildProcessDataIO::ChildProcessReadyToRun() deliber ately returning B_ERROR for testing purposes.\n");
return B_ERROR("Deliberate Error"); return B_ERROR("Deliberate Error");
} }
static void UnitTest() static void UnitTest()
skipping to change at line 147 skipping to change at line 147
if (s() == NULL) if (s() == NULL)
{ {
LogTime(MUSCLE_LOG_CRITICALERROR, "Error launching child process #" UIN T32_FORMAT_SPEC " [%s] [%s]!\n", i+1, cmd, ret()); LogTime(MUSCLE_LOG_CRITICALERROR, "Error launching child process #" UIN T32_FORMAT_SPEC " [%s] [%s]!\n", i+1, cmd, ret());
return 10; return 10;
} }
} }
StdinDataIO stdinIO(false); StdinDataIO stdinIO(false);
PlainTextMessageIOGateway stdinGateway; PlainTextMessageIOGateway stdinGateway;
QueueGatewayMessageReceiver stdinInputQueue; QueueGatewayMessageReceiver stdinInputQueue;
stdinGateway.SetDataIO(DataIORef(&stdinIO, false)); stdinGateway.SetDataIO(DummyDataIORef(stdinIO));
SocketMultiplexer multiplexer; SocketMultiplexer multiplexer;
for (uint32 i=0; i<refs.GetNumItems(); i++) for (uint32 i=0; i<refs.GetNumItems(); i++)
{ {
printf("------------ CHILD PROCESS #" UINT32_FORMAT_SPEC " --------------- ---\n", i+1); printf("------------ CHILD PROCESS #" UINT32_FORMAT_SPEC " --------------- ---\n", i+1);
PlainTextMessageIOGateway ioGateway; PlainTextMessageIOGateway ioGateway;
ioGateway.SetDataIO(refs[i]); ioGateway.SetDataIO(refs[i]);
ConstSocketRef readSock = refs[i]()->GetReadSelectSocket(); ConstSocketRef readSock = refs[i]()->GetReadSelectSocket();
QueueGatewayMessageReceiver ioInputQueue; QueueGatewayMessageReceiver ioInputQueue;
skipping to change at line 193 skipping to change at line 193
{ {
printf("Connection closed, exiting.\n"); printf("Connection closed, exiting.\n");
break; break;
} }
MessageRef incoming; MessageRef incoming;
while(ioInputQueue.RemoveHead(incoming).IsOK()) while(ioInputQueue.RemoveHead(incoming).IsOK())
{ {
printf("Heard message from server:---------------------------------- -\n"); printf("Heard message from server:---------------------------------- -\n");
const char * inStr; const char * inStr;
for (int i=0; (incoming()->FindString(PR_NAME_TEXT_LINE, i, &inStr). IsOK()); i++) printf("Line %i: [%s]\n", i, inStr); for (int j=0; (incoming()->FindString(PR_NAME_TEXT_LINE, j, &inStr). IsOK()); j++) printf("Line %i: [%s]\n", j, inStr);
printf("------------------------------------------------------------ -\n"); printf("------------------------------------------------------------ -\n");
} }
if ((reading == false)&&(writing == false)) break; if ((reading == false)&&(writing == false)) break;
multiplexer.RegisterSocketForReadReady(readFD); multiplexer.RegisterSocketForReadReady(readFD);
if (ioGateway.HasBytesToOutput()) multiplexer.RegisterSocketForWriteRea dy(writeFD); if (ioGateway.HasBytesToOutput()) multiplexer.RegisterSocketForWriteRea dy(writeFD);
} }
 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)