GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4TaskHandler.cxx
Go to the documentation of this file.
1 // $Id: TGo4TaskHandler.cxx 3062 2021-03-12 15:19:41Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4TaskHandler.h"
15 
16 #include "TSystem.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4Thread.h"
20 #include "TGo4ThreadHandler.h"
21 #include "TGo4Socket.h"
22 #include "TGo4BufferQueue.h"
23 #include "TGo4RuntimeException.h"
24 #include "TGo4DataRunnable.h"
25 #include "TGo4StatusRunnable.h"
26 #include "TGo4CommandRunnable.h"
27 #include "TGo4ServerTask.h"
28 #include "TGo4TaskHandlerStatus.h"
29 
30 const UInt_t TGo4TaskHandler::fguCONNECTORPORT=5000; // port no of default connector 9229
31 // 5000 is the first number of ROOT portscan
32 const UInt_t TGo4TaskHandler::fguTRANSPORTCHECKDELAY=5000; // delay in ms for transport init check
33 
34 const UInt_t TGo4TaskHandler::fguSTATUSQUEUESIZE=1000;
35 const UInt_t TGo4TaskHandler::fguDATAQUEUESIZE=1000;
36 const UInt_t TGo4TaskHandler::fguCOMMANDQUEUESIZE=1000;
37 
38 
39 const Int_t TGo4TaskHandler::fgiPORTWAITCYCLES=150;//60
40 
41 const UInt_t TGo4TaskHandler::fguPORTWAITTIME=200;//500
42 
44 
45 const UInt_t TGo4TaskHandler::fguTHREADSTOPTIME=500;
46 
47 const char* TGo4TaskHandler::fgcCONNECT="CONNECT-VERSION-300";
48 const char* TGo4TaskHandler::fgcDISCONNECT="DISCONNECT-VERSION-300";
49 
50 const char* TGo4TaskHandler::fgcOK = "OK-VERSION-300";
51 const char* TGo4TaskHandler::fgcERROR = "ERROR-VERSION-300";
52 
53 const char* TGo4TaskHandler::fgcMASTER="Master-VERSION-300";
54 const char* TGo4TaskHandler::fgcSLAVE="Slave-VERSION-300";
55 
56 const char* TGo4TaskHandler::fgcCOMMANDTHREAD="COMMAND-";
57 const char* TGo4TaskHandler::fgcSTATUSTHREAD="STATUS-";
58 const char* TGo4TaskHandler::fgcDATATHREAD="DATA-";
59 
60 TNamed TGo4TaskHandler::fgxOBSERVERACCOUNT("observer","go4view");
61 TNamed TGo4TaskHandler::fgxCONTROLLERACCOUNT("controller","go4ctrl");
62 TNamed TGo4TaskHandler::fgxADMINISTRATORACCOUNT("admin","go4super");
63 
64 TGo4TaskHandler::TGo4TaskHandler(const char* name, TGo4ThreadManager* threadmanager, Bool_t clientmode, Bool_t mastermode,UInt_t negotiationport)
65 :TNamed(name,"This is a Go4 Task Handler"),
66 fbIsAborting(kFALSE), fiComPort(0),fiStatPort(0),fiDatPort(0),fiRole(kGo4ComModeController)
67 {
68  fbClientMode=clientmode;
69  fbMasterMode=mastermode;
70  if(threadmanager==0)
71  {
72  // error
73  TGo4Log::Debug(" TaskHandler -- constructor error, unspecified ThreadManager: aborting ");
74  //throw TGo4RuntimeException();
75  }
76  else
77  {
78  // everything o.k.
79  }
80 
81  // set port number for the client server negotiation channel:
82  if(negotiationport==0)
83  {
84  // default: use taskhandler intrinsic port number
86  }
87  else
88  {
89  // use dynamic port number given by taskhandler owner
90  fuNegPort=negotiationport;
91  }
92 
93  fxThreadManager=threadmanager;
95  TString namebuffer;
96  fxInvoker=0;
97  fxCommandQueue= new TGo4BufferQueue("Command"); // receiv commands
98  fxStatusQueue= new TGo4BufferQueue("Status"); // send status buffer
99  fxDataQueue= new TGo4BufferQueue("Data"); // send data
100 
104  namebuffer.Form("CommandRunnable of %s",GetName());
105  // command runnable receivermode: receiving as slave and sending as master
106  fxCommandRun=new TGo4CommandRunnable(namebuffer.Data(), fxThreadManager, this, !IsMasterMode());
107 
108  namebuffer.Form("StatusRunnable of %s",GetName());
109  // status runnable receivermode: sending as slave and receiving as master
110  fxStatusRun=new TGo4StatusRunnable(namebuffer.Data(), fxThreadManager, this, IsMasterMode());
111 
112  namebuffer.Form("DataRunnable of %s",GetName());
113  // data runnable receivermode: sending as slave and receiving as master
114  fxDataRun=new TGo4DataRunnable(namebuffer.Data(), fxThreadManager, this, IsMasterMode());
115 
116  // adding runnables to thread handler who takes over the responsibility...:
117  namebuffer.Form("%s%s",fgcCOMMANDTHREAD,GetName());
118  fxComName=namebuffer;
120  namebuffer.Form("%s%s",fgcSTATUSTHREAD,GetName());
121  fxStatName=namebuffer;
123  namebuffer.Form("%s%s",fgcDATATHREAD,GetName());
124  fxDatName=namebuffer;
126  if(IsClientMode())
127  TGo4Log::Debug(" New TaskHandler %s in client mode ",GetName());
128  else
129  TGo4Log::Debug(" New TaskHandler %s in server mode ",GetName());
130 
131  // adjust queue size to our wishes
135 
136 
137 }
138 
140 {
144  delete fxCommandTransport;
145  delete fxStatusTransport;
146  delete fxDataTransport;
147  delete fxCommandQueue;
148  delete fxStatusQueue;
149  delete fxDataQueue;
150 }
151 
153 {
154  if(fbClientMode)
155  {
156  // we are client and want access to the server task (connector runnable)
157  TGo4Socket* connector=new TGo4Socket(kTRUE); // raw socket transport
158  connector->Open(host,fuNegPort); // open connection to server's connector runnable
159  if(ServerLogin(connector, GetRole()))
160  {
161  // client and server know each other- we continue
162  TString myname=fxThreadManager->GetName();
163  //std::cout <<"ServerRequest sends name "<<myname.Data() << std::endl;
164  connector->Send(myname.Data()); // tell server the client name
165  connector->Send(gSystem->HostName()); // tell server our machine hostname
166  return connector;
167  } //if(!strcmp(localbuffer,fgcOK))
168  else
169  {
170  // error: client does not match to server-- connect failed
171  connector->Send(Get_fgcERROR()); // send dummy strings, server will come out of receive
172  connector->Send(Get_fgcERROR()); // might check the errortext at server later
173 #ifdef WIN32
174  gSystem->Sleep(1000);
175 #endif
176  connector->Close();
177  delete connector;
178  TGo4Log::Debug(" TaskHandler %s server connection ERROR ",GetName());
179  return 0;
180 
181  } // else if(!strcmp(localbuffer,fgcOK))
182  } //if(fbClientMode)
183 
184  // we _are_ a server task handler , shall not request to our own Server task
185  return 0;
186 }
187 
188 
189 Bool_t TGo4TaskHandler::Connect(const char* host, TGo4Socket* connector)
190 // establish connection of all three channels
191 {
192  TGo4Log::Debug(" TaskHandler %s connecting to host %s ...",GetName(),host);
193  char* recvchar;
194  if(fbClientMode)
195  {
197  SetAborting(kFALSE); // reset if we reconnect after exception disconnect
198  fxHostName=host;// remember hostname for later DisConnect
199  if(connector==0)
200  {
201  // normal mode for client: we establish negotiation connection first
202  connector=ServerRequest(host); // get negotiation channel from server
203  }
204  if(connector)
205  {
206  // request was successful, we keep talking:
207  connector->Send(fgcCONNECT); // tell server we want to connect
208  recvchar=connector->RecvRaw("dummy");
209  if(recvchar==0)
210  {
211  TGo4Log::Debug(" TaskHandler %s; Error on server connection, abortin... ",GetName());
212  connector->Close();
213  throw TGo4RuntimeException();
214  }
215  if(!strcmp(recvchar,Get_fgcERROR()))
216  {
217  // server refuses to connect us, we abort
218  TGo4Log::Debug(" TaskHandler %s; Server refuses Connection",GetName());
219  connector->Send(fgcOK); // tell server we are through
220 #ifdef WIN32
221  gSystem->Sleep(1000);
222 #endif
223  connector->Close();
224  throw TGo4RuntimeException();
225  }
226  if(!ConnectClientChannel("Command",connector,fxCommandTransport,host))
227  {
228  TGo4Log::Debug(" TaskHandler %s; negotiation error, FAILED to open Command Channel",GetName());
229  throw TGo4RuntimeException();
230  }
231  if(!ConnectClientChannel("Status",connector,fxStatusTransport,host))
232  {
233  TGo4Log::Debug(" TaskHandler %s; negotiation error, FAILED to open Status Channel",GetName());
234  throw TGo4RuntimeException();
235  }
236  if(!ConnectClientChannel("Data",connector,fxDataTransport,host))
237  {
238  TGo4Log::Debug(" TaskHandler %s; negotiation error, FAILED to open Data Channel",GetName());
239  throw TGo4RuntimeException();
240  }
241  connector->Send(fgcOK); // tell server we finish negotiation
242 #ifdef WIN32
243  gSystem->Sleep(1000);
244 #endif
245  connector->Close();
246  TGo4Log::Debug(" TaskHandler %s closed negotiation connection ",GetName());
247  delete connector;
248  }
249  else
250  {
251  // something failed
252  TGo4Log::Debug(" TaskHandler %s server connection ERROR ",GetName());
253  return kFALSE;
254  } // if(connector)
255  } //if(fbClientMode)
256  else
257  {
259  const char* client=GetName();
260  if(connector==0) return kFALSE;
261  connector->Send(TGo4TaskHandler::fgcOK);
262  // first ok to initialize client, fgcERROR would abort client
263  if (!ConnectServerChannel("Command",connector, fxCommandTransport, host))
264  {
265  TGo4Log::Debug(" TaskHandler: Command channel connect ERROR for client %s ",client);
266  return kFALSE;
267  }
268  if (!ConnectServerChannel("Status",connector, fxStatusTransport, host))
269  {
270  TGo4Log::Debug(" TaskManager: Status channel connect ERROR for client %s ",client);
271  return kFALSE;
272  }
273  if (!ConnectServerChannel("Data",connector, fxDataTransport, host))
274  {
275  TGo4Log::Debug(" TaskManager: Data channel connect ERROR for client %s ",client);
276  return kFALSE;
277  }
278  } //if(fbClientMode)
279 
280  fiComPort=WaitGetPort(fxCommandTransport); // set port numbers for runnables
284 
285  return kTRUE;
286 }
287 
289 {
290  if(connector==0) return kFALSE;
291  //std::cout <<"ServerLogin with mode "<<account << std::endl;
292  //std::cout <<"observer account is "<<TGo4TaskHandler::fgxOBSERVERACCOUNT.GetName()<<", "<<TGo4TaskHandler::fgxOBSERVERACCOUNT.GetTitle() << std::endl;
293  //std::cout <<"controller account is "<<TGo4TaskHandler::fgxCONTROLLERACCOUNT.GetName()<<", "<<TGo4TaskHandler::fgxCONTROLLERACCOUNT.GetTitle() << std::endl;
294  //std::cout <<"admin account is "<<TGo4TaskHandler::fgxADMINISTRATORACCOUNT.GetName()<<", "<<TGo4TaskHandler::fgxADMINISTRATORACCOUNT.GetTitle() << std::endl;
295 
296  connector->Send(fgcOK); // tell server that we are a valid client
297 
298  // tell server if we are master or slave:
299  if(fbMasterMode)
300  connector->Send(fgcMASTER);
301  else
302  connector->Send(fgcSLAVE);
303 
304  // now send accountname and password:
305  switch (account)
306  {
307  case kGo4ComModeObserver:
308  connector->Send(fgxOBSERVERACCOUNT.GetName());
309  connector->Send(fgxOBSERVERACCOUNT.GetTitle());
310  break;
311 
313  connector->Send(fgxCONTROLLERACCOUNT.GetName());
314  connector->Send(fgxCONTROLLERACCOUNT.GetTitle());
315  break;
316 
318  connector->Send(fgxADMINISTRATORACCOUNT.GetName());
319  connector->Send(fgxADMINISTRATORACCOUNT.GetTitle());
320  break;
321 
322  default:
323  connector->Send(Get_fgcERROR());
324  connector->Send(Get_fgcERROR());
325  break;
326  }
327 
328  char * recvchar=connector->RecvRaw("dummy");// handshake back if it is ok
329  if(recvchar && !strcmp(recvchar,fgcOK)) return kTRUE;
330  return kFALSE;
331 }
332 
333 Bool_t TGo4TaskHandler::DisConnect(Bool_t waitforclient)
334 {
335  TGo4Log::Debug(" TaskHandler %s disconnecting ",GetName());
336  //TGo4Task* task=dynamic_cast<TGo4Task*>(fxThreadManager);
337  if(fbClientMode)
338  {
339  if(!IsAborting())
340  {
341  // normal DisConnect mode:
342  // we are client, have to tell server to let us go...
343  TGo4Socket* connector=ServerRequest(GetHostName()); // get negotiation channel from server
344  if(connector)
345  {
346  // request was successful, we keep talking:
347  // task->StopWorkThreads();
348  // if(task->IsMaster())
349  // fxCommandQueue->Clear();// only clear command queue on master side,
350  // // otherwise we lose status messages from server
351  // task->WakeCommandQueue(TGo4Task::Get_fgiTERMID()); // will stop local command thread, and remote
352  // task->SendStopBuffers(); // only stop remote threads if login was successful!
354  connector->Send(fgcDISCONNECT); // tell server we want to disconnect
355  StopTransportThreads(kTRUE);// wait until threads are really stopped
356  //std::cout <<"TASKHANDLER DISCONNECT closing the transports now.... " << std::endl;
357  CloseChannels();
358  connector->Send(fgcOK); // tell server we finished transports
359  // server will close its transport sockets after this
360 
361  connector->Send(fgcOK); // second ok to let server shutdown connector
362 #ifdef WIN32
363  gSystem->Sleep(1000);
364 #endif
365  connector->Close();
366  delete connector;
367  }
368  else
369  {
370  // something failed
371  TGo4Log::Debug(" TaskHandler %s server disconnect login ERROR - Trying Fast DisConnect... ",GetName());
372  StopTransportThreads(kFALSE);
373  CloseChannels("force");
374  //return kFALSE;
375  }
376  }
377  else // if(!IsAborting())
378  {
379  // DisConnect after exception, fast Close without negotiations
380  TGo4Log::Debug(" Client Aborting mode: Fast DisConnect... ",GetName());
381  StopTransportThreads(kFALSE);
382  CloseChannels("force");
383  }
384  }
385  else
386  {
387  StopTransportThreads(waitforclient);// wait until threads are really stopped
388  CloseChannels();
389  }
390  return kTRUE;
391 }
392 
394 {
395  //TString option=opt;
396  //if(option=="force")
397  // {
398  // std::cout <<"sSSSSSSSSSSSS CloseChannels sending abort buffer" << std::endl;
399  // TGo4Task* task=dynamic_cast<TGo4Task*>(fxThreadManager);
400  // // provoke socket exception on receiver channels:
401  // if(fbMasterMode)
402  // {
403  // fxCommandTransport->SendBuffer(task->GetAbortBuffer());
404  // }
405  // else
406  // {
407  // fxDataTransport->SendBuffer(task->GetAbortBuffer());
408  // fxStatusTransport->SendBuffer(task->GetAbortBuffer());
409  //
410  // }
411  // }
412  fxDataTransport->Close(opt);
414  fxStatusTransport->Close(opt);
415  ClearQueues();
416 
417 }
418 
420 {
421  fxDataQueue->Clear();
423  fxStatusQueue->Clear();
424 
425 }
426 
428 {
429  TGo4TaskHandlerStatus* state= new TGo4TaskHandlerStatus(GetName());
430  // we are friend of our status class, may use private setters:
431  state->SetFlags(fbIsAborting);
434  return state;
435 }
436 
437 
438 
439 Bool_t TGo4TaskHandler::ConnectServerChannel(const char* name, TGo4Socket* negotiator, TGo4Socket* channel, const char* host)
440 {
441  char* revchar=0;
442  Int_t waitresult=0;
443  UInt_t port=0;
444  TGo4ServerTask* server=dynamic_cast<TGo4ServerTask*>(fxThreadManager);
445  if(server==0)
446  {
447  TGo4Log::Debug(" TaskHandler: Channel %s open ERROR: no server task ",name);
448  return kFALSE;
449  }
450  if(negotiator==0 || !negotiator->IsOpen())
451  {
452  TGo4Log::Debug(" TaskHandler: Channel %s open ERROR: no negotiation channel ",name);
453  return kFALSE;
454  }
455  if(channel==0)
456  {
457  TGo4Log::Debug(" TaskHandler: Channel %s open ERROR: no TGo4Socket instance ",name);
458  return kFALSE;
459  }
460  const char* client=GetName(); // taskhandler name is client name
461  // in server mode, we connect by the connector thread:
462  // need timer mechanism for proper registration of ROOT sockets (timer is main thread)
463  // only root sockets connected in main application thread will be cleaned up
464  server->SetConnect(channel, host,0,kTRUE);
465  // tell the ServerTask timer we want to connect; portscan. we keep server socket open for windows
466  waitresult=server->WaitForOpen(); // wait for the server Open() call by timer
467  if(waitresult<0)
468  {
469  // open timeout
470  TGo4Log::Debug(" TaskHandler: Channel %s open TIMEOUT for client %s ",name, client);
471  return kFALSE;
472  }
473  else
474  {
475  // ok, proceed
476  }
477  port=WaitGetPort(channel);
478  if (port<0)
479  {
480  TGo4Log::Debug(" TaskHandler: Channel %s getport TIMEOUT for client %s ",name, client);
481  return kFALSE;
482  }
483  else {}
484  negotiator->Send(TGo4TaskHandler::fgcOK); // tell client we are ready to connect
485  TString localbuffer;
486  localbuffer.Form("%d",port);
487  negotiator->Send(localbuffer.Data()); // tell client the port number;
488  //std::cout <<"------- ConnectServerChannel offers portnumber "<< localbuffer<< " for Channel "<< name << std::endl;
489  revchar=negotiator->RecvRaw("dummy"); // wait for client connection ok
490  if(revchar && !strcmp(revchar,TGo4TaskHandler::fgcOK))
491  {
492  // o.k., client tells us connection is open, continue
493  }
494  else
495  {
496  // something went wrong, no ok
497  TGo4Log::Debug(" TaskHandler: Negotiation ERROR after Channel %s open for client %s ",
498  name, client);
499  return kFALSE;
500  //throw TGo4RuntimeException();
501  }
502 
503  waitresult=server->WaitForConnection(); // we also check ourselves if timer has returned from server open
504  if(waitresult<0)
505  {
506  // connect timeout
507  TGo4Log::Debug(" TaskHandler: Channel %s connect TIMEOUT for client %s ", name, client);
508  return kFALSE;
509  }
510  else
511  {
512  // ok, proceed
513  }
514  TGo4Log::Debug(" TaskHandler: Channel %s for client %s open!",name, client);
515  return kTRUE;
516 }
517 
518 Bool_t TGo4TaskHandler::ConnectClientChannel(const char* name, TGo4Socket * negotiator, TGo4Socket * channel, const char* host)
519 {
520  //
521  char* recvchar=0;
522  Int_t port=0;
523  if(negotiator==0 || !negotiator->IsOpen())
524  {
525  TGo4Log::Debug(" TaskHandler: Channel %s open ERROR: no negotiation channel ",name);
526  return kFALSE;
527  }
528  if(channel==0)
529  {
530  TGo4Log::Debug(" TaskHandler: Channel %s open ERROR: no TGo4Socket instance ",name);
531  return kFALSE;
532  }
533 
534  recvchar=negotiator->RecvRaw("dummy");// get OK from server to connect first channel
535  if(recvchar && !strcmp(recvchar,fgcOK))
536  {
537  // get portnumber from server:
538  recvchar=negotiator->RecvRaw("dummy");
539  TString localbuffer = recvchar;
540  port=atoi(localbuffer.Data());
541  // std::cout <<"------- TaskHandler::Connect client tries port "<< port << "for Channel "<< name << std::endl;
542  channel->Open(host,port); // in client mode, we connect directly (main thread!)
543  TGo4Log::Debug(" TaskHandler %s: Channel %s open!",GetName(), name );
544  negotiator->Send(fgcOK); // tell server that open is ready
545  return kTRUE;
546  }
547  else
548  {
549  TGo4Log::Debug(" TaskHandler %s; negotiation error, FAILED to open Channel %s ",
550  GetName(), name);
551  return kFALSE;
552  //throw TGo4RuntimeException();
553  } // if(!strcmp(recvchar,fgcOK))
554 }
556 
557 {
558  Int_t count=0;
559  Int_t port=0;
560  while(port==0)
561  {
562  port=sock->GetPort(); // get dynamically bound port number of server socket
563  // std::cout <<"------- WaitGetPort has next portnumber "<< port << std::endl;
564  if(count>fgiPORTWAITCYCLES)
565  {
566  return -1;
567  }
568  else if(fxThreadManager->IsTerminating())
569  {
570  return -2;
571  }
572  else
573  {
575  ++count;
576  }
577  }
578  return port;
579 
580 }
581 
583 {
584  fxThreadHandler->Start(GetComName()); // start runnables
587 }
588 
590 {
591  Bool_t rev=kTRUE;
593  if(IsMasterMode())
594  {
595  TGo4BufferQueue* comq= dynamic_cast<TGo4BufferQueue*>(GetCommandQueue());
596  if(comq)
597  {
598  //std::cout <<"SSSSSStopTransportThreads Waking command queue" << std::endl;
599  comq->Wake();
600  }
601  }
604  if(wait)
605  {
606  rev&=WaitThreadStop(GetComName());
607  rev&=WaitThreadStop(GetStatName());
608  rev&=WaitThreadStop(GetDatName());
609  }
610  return rev;
611 }
612 
613 Bool_t TGo4TaskHandler::WaitThreadStop(const char* name)
614 {
615  if(name==0) return kFALSE;
616  TGo4Thread* thread=fxThreadHandler->GetThread(name);
617  if(thread==0) return kFALSE;
618  Int_t t=0;
619  Bool_t timeout=kFALSE;
620  while(!thread->IsWaiting())
621  {
622  TGo4Log::Debug(" TaskHandler Disconnect -- waiting for runnable %s to stop... ",name);
625  {
626  timeout=kTRUE;
627  break;
628  }
629  }
630  return (!timeout);
631 }
632 
633 void TGo4TaskHandler::SetAdminAccount(const char* name, const char* passwd)
634 {
635  if(name) fgxADMINISTRATORACCOUNT.SetName(name);
636  if(passwd) fgxADMINISTRATORACCOUNT.SetTitle(passwd);
637 }
638 
639 void TGo4TaskHandler::SetCtrlAccount(const char* name, const char* passwd)
640 {
641  if(name) fgxCONTROLLERACCOUNT.SetName(name);
642  if(passwd) fgxCONTROLLERACCOUNT.SetTitle(passwd);
643 }
644 
645 void TGo4TaskHandler::SetObservAccount(const char* name, const char* passwd)
646 {
647  if(name) fgxOBSERVERACCOUNT.SetName(name);
648  if(passwd) fgxOBSERVERACCOUNT.SetTitle(passwd);
649 }
650 
652 {
653  return fgcOK;
654 }
655 
657 {
658  return fgcERROR;
659 }
660 
662 {
663  return fguPORTWAITTIME;
664 }
665 
667 {
668  return fgiPORTWAITCYCLES;
669 }
static const char * fgcSTATUSTHREAD
void SetPorts(UInt_t neg, Int_t com, Int_t stat, Int_t dat)
const char * GetDatName() const
static const UInt_t fguDATAQUEUESIZE
Bool_t DisConnect(Bool_t waitforclient=kTRUE)
TGo4Thread * GetThread(const char *name)
static TNamed fgxADMINISTRATORACCOUNT
virtual Int_t Close(Option_t *opt="")
Definition: TGo4Socket.cxx:212
static UInt_t Get_fguPORTWAITTIME()
static const char * fgcDATATHREAD
void SetMaxEntries(Int_t max)
Definition: TGo4Queue.h:45
Bool_t StopTransportThreads(Bool_t wait=kTRUE)
virtual Int_t Send(TObject *obj)
Definition: TGo4Socket.cxx:338
Int_t WaitForConnection()
TGo4Queue * fxDataQueue
Go4CommandMode_t
Definition: TGo4Command.h:27
static const UInt_t fguCOMMANDQUEUESIZE
static void SetObservAccount(const char *name, const char *passwd)
virtual void Wake()
Definition: TGo4Queue.cxx:90
TGo4ThreadManager * fxThreadManager
Bool_t IsAborting() const
static const Int_t fgiPORTWAITCYCLES
static const UInt_t fguTRANSPORTCHECKDELAY
static const char * Get_fgcERROR()
static const char * fgcERROR
static const Int_t fgiTHREADSTOPCYCLES
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:335
static const char * Get_fgcOK()
TGo4DataRunnable * fxDataRun
Bool_t IsClientMode() const
static void SetCtrlAccount(const char *name, const char *passwd)
void SetAborting(Bool_t isaborting=kTRUE)
virtual Int_t Open(const char *host, Int_t port, Bool_t keepservsock=kFALSE)
Definition: TGo4Socket.cxx:92
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
TGo4Queue * GetCommandQueue() const
static const UInt_t fguSTATUSQUEUESIZE
void SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv=kFALSE)
Bool_t IsWaiting() const
Definition: TGo4Thread.h:86
TGo4Queue * fxCommandQueue
TGo4StatusRunnable * fxStatusRun
TGo4Socket * fxCommandTransport
Bool_t WaitThreadStop(const char *name)
static const UInt_t fguPORTWAITTIME
TGo4CommandRunnable * fxCommandRun
static const char * fgcCONNECT
Bool_t ConnectServerChannel(const char *name, TGo4Socket *negotiator, TGo4Socket *channel, const char *host)
TGo4Socket * fxStatusTransport
TGo4ThreadHandler * GetWorkHandler() const
void SetFlags(Bool_t isaborting)
static const char * fgcOK
const char * GetComName() const
const char * GetStatName() const
static const char * fgcCOMMANDTHREAD
static const char * fgcMASTER
Bool_t Stop(const char *thname)
TGo4Socket * fxDataTransport
Bool_t ConnectClientChannel(const char *name, TGo4Socket *negotiator, TGo4Socket *channel, const char *host)
const char * GetHostName() const
TGo4ThreadHandler * fxThreadHandler
Bool_t Start(const char *thname)
virtual TGo4TaskHandlerStatus * CreateStatus()
virtual ~TGo4TaskHandler()
Bool_t IsMasterMode() const
static const UInt_t fguCONNECTORPORT
static TNamed fgxCONTROLLERACCOUNT
Go4CommandMode_t GetRole()
static const char * fgcSLAVE
static const UInt_t fguTHREADSTOPTIME
static TNamed fgxOBSERVERACCOUNT
static void SetAdminAccount(const char *name, const char *passwd)
Bool_t RemoveThread(const char *name)
Bool_t IsTerminating() const
static Int_t Get_fgiPORTWAITCYCLES()
Int_t GetPort() const
Definition: TGo4Socket.h:40
Bool_t IsOpen() const
Definition: TGo4Socket.h:36
static const char * fgcDISCONNECT
virtual char * RecvRaw(const char *name=0)
Definition: TGo4Socket.cxx:407
TGo4Queue * fxStatusQueue
TGo4CommandInvoker * fxInvoker
TGo4Socket * ServerRequest(const char *host="localhost")
virtual void Clear(Option_t *opt="")
Definition: TGo4Queue.cxx:44
Int_t WaitGetPort(TGo4Socket *sock)
Bool_t Connect(const char *host="localhost", TGo4Socket *negotiator=0)
void SetNames(const char *com, const char *stat, const char *dat, const char *host)
Bool_t ServerLogin(TGo4Socket *connector, Go4CommandMode_t account)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274
void CloseChannels(Option_t *opt="")