From b0fff9b9e5becf35cdd051a81d0574a3a6c3be2a Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 10 May 1994 11:36:23 +0000 Subject: replaced TRUE/FALSE by true/false --- comm/OLD/Agent.cc | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'comm/OLD/Agent.cc') 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); } -- cgit v1.1