00001 #ifndef __XRDCMSMANTREE_HH_
00002 #define __XRDCMSMANTREE_HH_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "XrdCms/XrdCmsManager.hh"
00034 #include "XrdSys/XrdSysPthread.hh"
00035
00036 class XrdCmsNode;
00037
00038 class XrdCmsManTree
00039 {
00040 public:
00041
00042 void Abort();
00043
00044 int Connect(int nID, XrdCmsNode *nP);
00045
00046 void Disc(int nID);
00047
00048 int Register();
00049
00050 int Trying(int nID, int Lvl);
00051
00052 enum connStat {Aborted, Active, Connected, None, Pending, Waiting};
00053
00054 XrdCmsManTree(int maxC);
00055 ~XrdCmsManTree() {};
00056
00057 private:
00058
00059 void Redrive(int nID) {tmInfo[nID].Status = Active;
00060 tmInfo[nID].theSem.Post();
00061 numWaiting--;
00062 }
00063 void Pause(int nID) {tmInfo[nID].Status = Waiting;
00064 numWaiting++;
00065 myMutex.UnLock();
00066 tmInfo[nID].theSem.Wait();
00067 }
00068
00069 XrdSysMutex myMutex;
00070
00071
00072 struct TreeInfo
00073 {XrdSysSemaphore theSem;
00074 XrdCmsNode *nodeP;
00075 connStat Status;
00076 int Level;
00077
00078 TreeInfo() : theSem(0), nodeP(0), Status(None), Level(0) {};
00079 ~TreeInfo() {};
00080
00081 } tmInfo[XrdCmsManager::MTMax];
00082
00083 char buff[16];
00084 int maxTMI;
00085 int numConn;
00086 int maxConn;
00087 int atRoot;
00088 int conLevel;
00089 int conNID;
00090 int numWaiting;
00091 connStat myStatus;
00092 };
00093 #endif