summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-10-31 20:22:40 +0000
committerMike Buland <eichlan@xagasoft.com>2006-10-31 20:22:40 +0000
commit73cb610641b9d69aea0f75b6ccd26236e6c8c3fc (patch)
treed583b15671c501b0bcf6bec8304eb3a814140460
parent251de734feb2be2d414255dff8358045116e28e1 (diff)
downloadlibbu++-73cb610641b9d69aea0f75b6ccd26236e6c8c3fc.tar.gz
libbu++-73cb610641b9d69aea0f75b6ccd26236e6c8c3fc.tar.bz2
libbu++-73cb610641b9d69aea0f75b6ccd26236e6c8c3fc.tar.xz
libbu++-73cb610641b9d69aea0f75b6ccd26236e6c8c3fc.zip
Update to ConnectionManager, things are much, much better now.
-rw-r--r--src/connectionmanager.cpp2
-rw-r--r--src/programchain.h99
-rw-r--r--src/programlink.h2
3 files changed, 55 insertions, 48 deletions
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 8b62026..3e9f1a8 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -77,7 +77,7 @@ bool ConnectionManager::startServer( int nPort )
77 return false; 77 return false;
78 } 78 }
79 79
80 if (listen (nMasterSocket, 1) < 0) 80 if (listen (nMasterSocket, 40) < 0)
81 { 81 {
82 xLog.LineLog( MultiLog::LError, "Couldn't begin listening to the server socket."); 82 xLog.LineLog( MultiLog::LError, "Couldn't begin listening to the server socket.");
83 return false; 83 return false;
diff --git a/src/programchain.h b/src/programchain.h
index 1752d2c..2bdfeee 100644
--- a/src/programchain.h
+++ b/src/programchain.h
@@ -5,10 +5,11 @@
5#include "multilog.h" 5#include "multilog.h"
6#include "programlink.h" 6#include "programlink.h"
7 7
8/** The Program Chain links together program "chunks" to more easily facilitate 8/**
9 * a generalized program loop with modular extensions. 9 * The Program Chain links together program "chunks" to more easily facilitate
10 *@author Mike Buland 10 * a generalized program loop with modular extensions.
11 */ 11 *@author Mike Buland
12 */
12class ProgramChain 13class ProgramChain
13{ 14{
14public: 15public:
@@ -22,58 +23,64 @@ public:
22 */ 23 */
23 virtual ~ProgramChain(); 24 virtual ~ProgramChain();
24 25
25 /** Adds a link to the end of the chain. 26 /**
26 *@param pLink A pointer to the link to add to the chain. 27 * Adds a link to the end of the chain.
27 *@returns True if adding the link was successful, otherwise false 28 *@param pLink A pointer to the link to add to the chain.
28 *@author Mike Buland 29 *@returns True if adding the link was successful, otherwise false
29 */ 30 *@author Mike Buland
31 */
30 bool addLink( ProgramLink *pLink ); 32 bool addLink( ProgramLink *pLink );
31 33
32 /** Gets a link by name. 34 /**
33 *@param lpName The name of the link you're looking for. Every link has a 35 * Gets a link by name.
34 * name, apparently. 36 *@param lpName The name of the link you're looking for. Every link has a
35 *@returns A pointer to the specified ProgramLink, or NULL if none were found 37 * name, apparently.
36 * matching your criteria. 38 *@returns A pointer to the specified ProgramLink, or NULL if none were
37 *@author Mike Buland 39 * found matching your criteria.
38 */ 40 *@author Mike Buland
41 */
39 class ProgramLink *getLink( const char *lpName ); 42 class ProgramLink *getLink( const char *lpName );
40 43
41 /** Gets the very first link in the chain. 44 /**
42 *@returns A pointer to the first link in the chain. 45 * Gets the very first link in the chain.
43 *@author Mike Buland 46 *@returns A pointer to the first link in the chain.
44 */ 47 *@author Mike Buland
48 */
45 class ProgramLink *getBaseLink(); 49 class ProgramLink *getBaseLink();
46 50
47 /** Runs through the chain once. Useful if you want to have more control over 51 /**
48 * the operation of the chain. 52 * Runs through the chain once. Useful if you want to have more control
49 *@returns true if every link returned true. If at least one link returns false, 53 * over the operation of the chain.
50 * then returns false. 54 *@returns true if every link returned true. If at least one link returns
51 *@author Mike Buland 55 * false, then returns false.
52 */ 56 *@author Mike Buland
57 */
53 bool execChainOnce(); 58 bool execChainOnce();
54 59
55 /** Enters the master chain loop, looping over the entire chain and executing 60 /**
56 * every link's TimeSlice routine in order, over and over, until a link returns 61 * Enters the master chain loop, looping over the entire chain and
57 * a false value. 62 * executing every link's TimeSlice routine in order, over and over, until
58 *@returns False, always. It returns true unless a link returned false, but loops 63 * a link returns a false value.
59 * until a link does return false. 64 *@returns False, always. It returns true unless a link returned false,
60 *@author Mike Buland 65 * but loops until a link does return false.
61 **/ 66 *@author Mike Buland
67 **/
62 bool enterChainLoop(); 68 bool enterChainLoop();
63 69
64 /** Broadcasts an Immediate Response Message to all active links, save the 70 /**
65 * sender. Whatever link first responds with a non-null response message 71 * Broadcasts an Immediate Response Message to all active links, save the
66 * will have it's messages sent back to the broadcasting link as the returns 72 * sender. Whatever link first responds with a non-null response message
67 * of this function call. Therefore it is very important that all message 73 * will have it's messages sent back to the broadcasting link as the returns
68 * processing code is handled in a fairly timely fasion. 74 * of this function call. Therefore it is very important that all message
69 *@param pMsgOut The message to broadcast in hopes of a response. 75 * processing code is handled in a fairly timely fasion.
70 *@param pSender The message that sent out the message and doesn't want to 76 *@param pMsgOut The message to broadcast in hopes of a response.
71 * receive it's own message. This should always just be "this". 77 *@param pSender The message that sent out the message and doesn't want to
72 *@returns The message that was returned by the first link to return a 78 * receive it's own message. This should always just be "this".
73 * non-null response. If all messages return null responses then this also 79 *@returns The message that was returned by the first link to return a
74 * returns null. Please note that whoever calls this will be responsible 80 * non-null response. If all messages return null responses then this also
75 * for deleting the message returned by it, if non-null. 81 * returns null. Please note that whoever calls this will be responsible
76 */ 82 * for deleting the message returned by it, if non-null.
83 */
77 class LinkMessage *broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender ); 84 class LinkMessage *broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender );
78 85
79private: 86private:
diff --git a/src/programlink.h b/src/programlink.h
index 6499fc2..f93edcc 100644
--- a/src/programlink.h
+++ b/src/programlink.h
@@ -70,7 +70,7 @@ public:
70 70
71private: 71private:
72 /** 72 /**
73 * Set which chain we're assosiated with. This is hope IRM messages make 73 * Set which chain we're assosiated with. This is how IRM messages make
74 * it out to the rest of the world. 74 * it out to the rest of the world.
75 *@param pNewChain A pointer to the containing program chain. 75 *@param pNewChain A pointer to the containing program chain.
76 */ 76 */