summaryrefslogtreecommitdiff
path: root/comm/OLD/Agent.cc
diff options
context:
space:
mode:
authorchatty1994-05-10 11:36:23 +0000
committerchatty1994-05-10 11:36:23 +0000
commitb0fff9b9e5becf35cdd051a81d0574a3a6c3be2a (patch)
treef6e866161bb17587d344d0fbdf30cef57b435444 /comm/OLD/Agent.cc
parent6f03fc87b2858caf3424639cbba2d38f8f8f3029 (diff)
downloadivy-league-b0fff9b9e5becf35cdd051a81d0574a3a6c3be2a.zip
ivy-league-b0fff9b9e5becf35cdd051a81d0574a3a6c3be2a.tar.gz
ivy-league-b0fff9b9e5becf35cdd051a81d0574a3a6c3be2a.tar.bz2
ivy-league-b0fff9b9e5becf35cdd051a81d0574a3a6c3be2a.tar.xz
replaced TRUE/FALSE by true/false
Diffstat (limited to 'comm/OLD/Agent.cc')
-rw-r--r--comm/OLD/Agent.cc32
1 files changed, 13 insertions, 19 deletions
diff --git a/comm/OLD/Agent.cc b/comm/OLD/Agent.cc
index ec4c28d..dadfd3c 100644
--- a/comm/OLD/Agent.cc
+++ b/comm/OLD/Agent.cc
@@ -104,7 +104,7 @@ whenever a client connects to the server, an instance of \typ{UchRemoteAgent} is
Whenever data is readable from a client, it is read in an input buffer and processed as soon
as a full message is received.
Whenever a client closes the connection, it is removed from the channel set of the server.
-This function returns TRUE if all went well, else it calls \fun{SysError} and returns FALSE.
+This function returns true if all went well, else it calls \fun{SysError} and returns false.
You may want to pass your own channel set if you are already multiplexing
i/o on that channel set. For instance, you may have several \typ{UchAgent} objects
in your application.
@@ -116,7 +116,7 @@ UchAgent :: Setup (UchBaseMultiplexer* cs)
{
if (Listen () < 0) {
SysError (ErrWarn, "UchAgent::Setup");
- return FALSE;
+ return false;
}
SetMode (IORead);
if (!cs)
@@ -124,7 +124,7 @@ UchAgent :: Setup (UchBaseMultiplexer* cs)
Mpx = cs;
Mpx->Add (this);
- return TRUE;
+ return true;
}
/*?
@@ -148,18 +148,12 @@ UchAgent :: Unlisten ()
void
UchAgent :: HandleRead ()
{
-// cannot redefine Accept to return UchRemoteAgent*, so this does not work :
-// UchRemoteAgent* cl = Accept ();
-// need to delete the channel created by Accept, so this does not work either :
-// UchRemoteAgent* cl = new UchRemoteAgent (Accept ());
-// so we do this (less elegant ...) :
- UchChannel* ch = Accept ();
- if (! ch) {
+ int fd = Accept ();
+ if (fd < 0) {
SysError (ErrWarn, "UchAgent::HandleRead: Accept");
return;
}
- UchRemoteAgent* ra = HandleNew (ch);
- delete ch;
+ UchRemoteAgent* ra = CreateRemote (fd);
ra->SetMode (IOReadSelect);
RemoteAgents.Append (ra);
@@ -171,9 +165,9 @@ UchAgent :: HandleRead ()
This virtual function is called whenever a new agent connects to this one.
?*/
UchRemoteAgent*
-UchAgent :: HandleNew (UchChannel* ch)
+UchAgent :: CreateRemote (int fd)
{
- return new UchRemoteAgent (this, ch);
+ return new UchRemoteAgent (this, fd);
}
/*?
@@ -234,7 +228,7 @@ UchAgent :: Run ()
/*?
Send a message to all the agents currently connected to this one.
-If \var{flush} is TRUE, the output buffer of each remote agent is flushed.
+If \var{flush} is true, the output buffer of each remote agent is flushed.
?*/
void
UchAgent :: Broadcast (UchMessage& msg, bool flush)
@@ -252,7 +246,7 @@ UchAgent :: Broadcast (UchMessage& msg, bool flush)
/*?
Send a message to all the agents currently connected to this one, except \var{exclude}.
-If \var{flush} is TRUE, the output buffer of each client is flushed.
+If \var{flush} is true, the output buffer of each client is flushed.
?*/
void
UchAgent :: Broadcast (UchMessage& msg, UchRemoteAgent* excl, bool flush)
@@ -352,11 +346,11 @@ UchRemoteAgent :: UchRemoteAgent (const UchRemoteAgent& cl)
/*?
Construct a new agent connected to this one on channel \var{ch}.
?*/
-UchRemoteAgent :: UchRemoteAgent (UchAgent* a, UchChannel* ch)
+UchRemoteAgent :: UchRemoteAgent (UchAgent* a, int fd)
: UchMsgStream (),
MyLocalAgent (a)
{
- UchChannel::Open (ch->FilDes ());
+ UchChannel::Open (fd);
}
UchRemoteAgent :: UchRemoteAgent (UchAgent* a, UchAddress* addr)
@@ -365,7 +359,7 @@ UchRemoteAgent :: UchRemoteAgent (UchAgent* a, UchAddress* addr)
{
if (!Setup ())
SysError (ErrWarn, "Connect");
- SetSyncMode (TRUE);
+ SetSyncMode (true);
}