ROOT logo
// @(#)root/proofx:$Id: TXSocketHandler.cxx 26678 2008-12-05 14:53:23Z ganis $
// Author: Gerardo Ganis  12/12/2005

/*************************************************************************
 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TXSocketHandler                                                      //
//                                                                      //
// Input handler for xproofd sockets. These sockets cannot be directly  //
// monitored on their descriptor, because the reading activity goes via //
// the reader thread. This class allows to handle this problem.         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TMonitor.h"
#include "TProof.h"
#include "TSlave.h"
#include "TXSocketHandler.h"
#include "TXHandler.h"
#include "TList.h"


ClassImp(TXSocketHandler)

// Unique instance of the socket input handler
TXSocketHandler *TXSocketHandler::fgSocketHandler = 0;

//______________________________________________________________________________
Bool_t TXSocketHandler::Notify()
{
   // Set readiness on the monitor

   if (gDebug > 2)
      TXSocket::fgPipe.DumpReadySock();

   // Get the socket
   TXSocket *s = TXSocket::fgPipe.GetLastReady();
   if (gDebug > 2)
      Info("Notify", "ready socket %p (%s) (input socket: %p)",
                     s, (s ? s->GetTitle() : "***undef***"), fInputSock);

   // If empty, nothing to do
   if (!s) {
      Warning("Notify","socket-ready list is empty!");
      return kTRUE;
   }

   // Handle this input
   s->fHandler->HandleInput();

   // We are done
   return kTRUE;
}

//_______________________________________________________________________
TXSocketHandler *TXSocketHandler::GetSocketHandler(TFileHandler *h, TSocket *s)
{
   // Get an instance of the input socket handler with 'h' as handler,
   // connected to socket 's'.
   // Create the instance, if not already existing

   if (!fgSocketHandler)
      fgSocketHandler = new TXSocketHandler(h, s);
   else
      if (h && s)
         fgSocketHandler->SetHandler(h, s);

   return fgSocketHandler;
}
 TXSocketHandler.cxx:1
 TXSocketHandler.cxx:2
 TXSocketHandler.cxx:3
 TXSocketHandler.cxx:4
 TXSocketHandler.cxx:5
 TXSocketHandler.cxx:6
 TXSocketHandler.cxx:7
 TXSocketHandler.cxx:8
 TXSocketHandler.cxx:9
 TXSocketHandler.cxx:10
 TXSocketHandler.cxx:11
 TXSocketHandler.cxx:12
 TXSocketHandler.cxx:13
 TXSocketHandler.cxx:14
 TXSocketHandler.cxx:15
 TXSocketHandler.cxx:16
 TXSocketHandler.cxx:17
 TXSocketHandler.cxx:18
 TXSocketHandler.cxx:19
 TXSocketHandler.cxx:20
 TXSocketHandler.cxx:21
 TXSocketHandler.cxx:22
 TXSocketHandler.cxx:23
 TXSocketHandler.cxx:24
 TXSocketHandler.cxx:25
 TXSocketHandler.cxx:26
 TXSocketHandler.cxx:27
 TXSocketHandler.cxx:28
 TXSocketHandler.cxx:29
 TXSocketHandler.cxx:30
 TXSocketHandler.cxx:31
 TXSocketHandler.cxx:32
 TXSocketHandler.cxx:33
 TXSocketHandler.cxx:34
 TXSocketHandler.cxx:35
 TXSocketHandler.cxx:36
 TXSocketHandler.cxx:37
 TXSocketHandler.cxx:38
 TXSocketHandler.cxx:39
 TXSocketHandler.cxx:40
 TXSocketHandler.cxx:41
 TXSocketHandler.cxx:42
 TXSocketHandler.cxx:43
 TXSocketHandler.cxx:44
 TXSocketHandler.cxx:45
 TXSocketHandler.cxx:46
 TXSocketHandler.cxx:47
 TXSocketHandler.cxx:48
 TXSocketHandler.cxx:49
 TXSocketHandler.cxx:50
 TXSocketHandler.cxx:51
 TXSocketHandler.cxx:52
 TXSocketHandler.cxx:53
 TXSocketHandler.cxx:54
 TXSocketHandler.cxx:55
 TXSocketHandler.cxx:56
 TXSocketHandler.cxx:57
 TXSocketHandler.cxx:58
 TXSocketHandler.cxx:59
 TXSocketHandler.cxx:60
 TXSocketHandler.cxx:61
 TXSocketHandler.cxx:62
 TXSocketHandler.cxx:63
 TXSocketHandler.cxx:64
 TXSocketHandler.cxx:65
 TXSocketHandler.cxx:66
 TXSocketHandler.cxx:67
 TXSocketHandler.cxx:68
 TXSocketHandler.cxx:69
 TXSocketHandler.cxx:70
 TXSocketHandler.cxx:71
 TXSocketHandler.cxx:72
 TXSocketHandler.cxx:73
 TXSocketHandler.cxx:74
 TXSocketHandler.cxx:75
 TXSocketHandler.cxx:76