From da823819c7cdb88bd1d3a94d705b1f4371b5469d Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 17 Aug 1993 16:11:52 +0000 Subject: Added Multiplexer arg to constr and Init of TextService, to allow automatic adding to the multiplexer in Restart --- comm/OLD/TextStream.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'comm/OLD/TextStream.cc') diff --git a/comm/OLD/TextStream.cc b/comm/OLD/TextStream.cc index a869b9e..117c3ae 100644 --- a/comm/OLD/TextStream.cc +++ b/comm/OLD/TextStream.cc @@ -729,7 +729,7 @@ UchTextService :: UchTextService () Construct a \var{UchTextService} connected to server \var{s} on host \var{h}. This is equivalent to the empty constructor followed by a call to \fun{Init}. ?*/ -UchTextService :: UchTextService (const char* s, const char* h) +UchTextService :: UchTextService (UchBaseMultiplexer& mpx, const char* s, const char* h) : UchTextStream (), StatusFlag (isLost), Starter (0), @@ -738,7 +738,7 @@ UchTextService :: UchTextService (const char* s, const char* h) Service (), Host () { - Init (s, h); + Init (mpx, s, h); } /*? @@ -776,8 +776,7 @@ to that address. If this fails, it sets the state to \var{isError} and returns. Otherwise, it sets the state to \var{isRunning} and calls the virtual function \fun{GotServer}. -The service is automatically registered with the multiplexer -(by calling \fun{MpxAddChannel} with mode \var{IONone}) +The service is automatically registered with the multiplexer, with mode \var{IONone} the first time the connection is established. ?*/ UchTextService::status @@ -826,7 +825,8 @@ UchTextService :: Restart () setup = Setup (); if (! wasopened) { SetMode (IONone); - Mpx->Add (this); + if (Mpx) + Mpx->Add (this); ///////// Mpx was initialized by Init } if (! setup) { fprintf (stderr, "UchTextService::Restart, could not setup connection\n"); @@ -962,14 +962,15 @@ If the connection to the server cannot be established, \fun{Init} calls \var{AutoStart} to attempt the connection later. ?*/ void -UchTextService :: Init (const char* s, const char* h) +UchTextService :: Init (UchBaseMultiplexer& mpx, const char* s, const char* h) { if (StatusFlag == isRunning) return; Service = s; Host = h; - + Mpx = &mpx; + StatusFlag = Restart (); if (StatusFlag == isError) { // try to run the agent manager @@ -1031,6 +1032,7 @@ UchTextService :: CloseNow () Mpx->Remove (*this); } +#if 0 /*? This global function provides the simplest interface to send a request \var{req} to a server \var{sname} on host \var{host}. @@ -1044,3 +1046,4 @@ TellServer (const char* sname, const char* host, const char* req) serv->Close (); return TRUE; } +#endif -- cgit v1.1