XRootD
Loading...
Searching...
No Matches
XrdCmsClientMsg Class Reference

#include <XrdCmsClientMsg.hh>

Collaboration diagram for XrdCmsClientMsg:

Public Member Functions

 XrdCmsClientMsg ()
 ~XrdCmsClientMsg ()
int getResult ()
int ID ()
void Lock ()
void Recycle ()
void UnLock ()
int Wait4Reply (int wtime)

Static Public Member Functions

static XrdCmsClientMsgAlloc (XrdOucErrInfo *erp)
static int Init ()
static int inQ ()
static int Reply (const char *Man, XrdCms::CmsRRHdr &hdr, XrdOucBuffer *buff)

Detailed Description

Definition at line 40 of file XrdCmsClientMsg.hh.

Constructor & Destructor Documentation

◆ XrdCmsClientMsg()

XrdCmsClientMsg::XrdCmsClientMsg ( )
inline

Definition at line 64 of file XrdCmsClientMsg.hh.

64: Hold(0) {next = 0; inwaitq = 0; Resp = 0; Result = 0;}

Referenced by Alloc(), Init(), and Reply().

Here is the caller graph for this function:

◆ ~XrdCmsClientMsg()

XrdCmsClientMsg::~XrdCmsClientMsg ( )
inline

Definition at line 65 of file XrdCmsClientMsg.hh.

65{}

Member Function Documentation

◆ Alloc()

XrdCmsClientMsg * XrdCmsClientMsg::Alloc ( XrdOucErrInfo * erp)
static

Definition at line 60 of file XrdCmsClientMsg.cc.

61{
63 int lclid;
64
65// Allocate a message object
66//
67 FreeMsgQ.Lock();
68 if (nextfree) {mp = nextfree; nextfree = mp->next;}
69 else {FreeMsgQ.UnLock(); return (XrdCmsClientMsg *)0;}
70 lclid = nextid = (nextid + MidIncr) & IncMask;
71 numinQ++;
72 FreeMsgQ.UnLock();
73
74// Initialize it
75//
76 mp->Hold.Lock();
77 mp->id = (mp->id & MidMask) | lclid;
78 mp->Resp = erp;
79 mp->next = 0;
80 mp->inwaitq = 1;
81
82// Return the message object
83//
84 return mp;
85}

References XrdCmsClientMsg(), and XrdSysCondVar::Lock().

Here is the call graph for this function:

◆ getResult()

int XrdCmsClientMsg::getResult ( )
inline

Definition at line 46 of file XrdCmsClientMsg.hh.

46{return Result;}

◆ ID()

int XrdCmsClientMsg::ID ( )
inline

Definition at line 48 of file XrdCmsClientMsg.hh.

48{return id;}

◆ Init()

int XrdCmsClientMsg::Init ( )
static

Definition at line 91 of file XrdCmsClientMsg.cc.

92{
93 int i;
94 XrdCmsClientMsg *msgp;
95
96// Allocate the fixed number of msg blocks. These will never be freed!
97//
98 if (!(msgp = new XrdCmsClientMsg[MaxMsgs]())) return 1;
99 msgTab = &msgp[0];
100 nextid = MaxMsgs;
101
102// Place all of the msg blocks on the free list
103//
104 for (i = 0; i < MaxMsgs; i++)
105 {msgp->next = nextfree; nextfree = msgp; msgp->id = i; msgp++;}
106
107// All done
108//
109 return 0;
110}

References XrdCmsClientMsg().

Referenced by XrdCmsClientConfig::Configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inQ()

int XrdCmsClientMsg::inQ ( )
inlinestatic

Definition at line 52 of file XrdCmsClientMsg.hh.

52{return numinQ;}

Referenced by XrdCmsClientMan::whatsUp().

Here is the caller graph for this function:

◆ Lock()

void XrdCmsClientMsg::Lock ( )
inline

Definition at line 54 of file XrdCmsClientMsg.hh.

54{Hold.Lock();}

◆ Recycle()

void XrdCmsClientMsg::Recycle ( )

Definition at line 118 of file XrdCmsClientMsg.cc.

119{
120 static XrdOucErrInfo dummyResp;
121
122// Remove this from he wait queue and substitute a safe resp object. We do
123// this because a reply may be pending and will post when we release the lock
124//
125 inwaitq = 0;
126 Resp = &dummyResp;
127 Hold.UnLock();
128
129// Place message object on re-usable queue
130//
131 FreeMsgQ.Lock();
132 next = nextfree;
133 nextfree = this;
134 if (numinQ >= 0) numinQ--;
135 FreeMsgQ.UnLock();
136}

◆ Reply()

int XrdCmsClientMsg::Reply ( const char * Man,
XrdCms::CmsRRHdr & hdr,
XrdOucBuffer * buff )
static

Definition at line 142 of file XrdCmsClientMsg.cc.

143{
144 EPNAME("Reply")
145 XrdCmsClientMsg *mp;
146
147// Find the appropriate message
148//
149 if (!(mp = XrdCmsClientMsg::RemFromWaitQ(hdr.streamid)))
150 {DEBUG("to non-existent message; id=" <<hdr.streamid);
151 return 0;
152 }
153
154// Decode the response
155//
156 mp->Result = XrdCmsParser::Decode(Man,hdr,buff,(XrdOucErrInfo *)(mp->Resp));
157
158// Signal a reply and return
159//
160 mp->Hold.Signal();
161 mp->Hold.UnLock();
162 return 1;
163}
#define DEBUG(x)
#define EPNAME(x)
if(ec< 0) ec
static int Decode(const char *Man, XrdCms::CmsRRHdr &hdr, XrdOucBuffer *dBuff, XrdOucErrInfo *eInfo)
kXR_unt32 streamid
Definition YProtocol.hh:83

References XrdCmsClientMsg(), DEBUG, XrdCmsParser::Decode(), EPNAME, XrdSysCondVar::Signal(), XrdCms::CmsRRHdr::streamid, and XrdSysCondVar::UnLock().

Referenced by XrdCmsClientMan::Start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnLock()

void XrdCmsClientMsg::UnLock ( )
inline

Definition at line 60 of file XrdCmsClientMsg.hh.

60{Hold.UnLock();}

◆ Wait4Reply()

int XrdCmsClientMsg::Wait4Reply ( int wtime)
inline

Definition at line 62 of file XrdCmsClientMsg.hh.

62{return Hold.Wait(wtime);}

The documentation for this class was generated from the following files: