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