Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
XrdProofdClient.cxx
Go to the documentation of this file.
1// @(#)root/proofd:$Id$
2// Author: G. Ganis June 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
14// XrdProofdClient //
15// //
16// Author: G. Ganis, CERN, 2007 //
17// //
18// Auxiliary class describing a PROOF client. //
19// Used by XrdProofdProtocol. //
20// //
21//////////////////////////////////////////////////////////////////////////
22#include <sys/stat.h>
23
24#include "XrdNet/XrdNet.hh"
25#include "XrdSys/XrdSysPriv.hh"
26
27#include "XrdProofdClient.h"
28#include "XrdProofdProtocol.h"
29#include "XrdProofdProofServ.h"
31
32#include "XrdProofdTrace.h"
33
34////////////////////////////////////////////////////////////////////////////////
35/// Constructor
36
38 XrdSysError *, const char *adminpath, int rtime)
39 : fSandbox(ui, master, changeown)
40{
41 XPDLOC(CMGR, "Client::Client")
42
43 fProofServs.clear();
44 fClients.clear();
45 fUI = ui;
46 fROOT = 0;
47 fIsValid = 0;
48 fAskedToTouch = 0;
50 fReconnectTimeOut = rtime;
51
52 // Make sure the admin path exists
53 XPDFORM(fAdminPath, "%s/%s.%s", adminpath, ui.fUser.c_str(), ui.fGroup.c_str());
54 struct stat st;
55 if (stat(adminpath, &st) != 0) {
56 TRACE(XERR, "problems stating admin path "<<adminpath<<"; errno = "<<errno);
57 return;
58 }
59 XrdProofUI effui;
60 XrdProofdAux::GetUserInfo(st.st_uid, effui);
61 if (XrdProofdAux::AssertDir(fAdminPath.c_str(), effui, 1) != 0)
62 return;
63
64 // We must have a valid sandbox
65 if (fSandbox.IsValid()) fIsValid = 1;
66}
67
68////////////////////////////////////////////////////////////////////////////////
69/// Destructor
70
72{
73}
74
75////////////////////////////////////////////////////////////////////////////////
76/// return TRUE if this instance matches 'id' (and 'grp', if defined)
77
78bool XrdProofdClient::Match(const char *usr, const char *grp)
79{
80 if (!fIsValid) return 0;
81
82 bool rc = (usr && !strcmp(usr, User())) ? 1 : 0;
83 if (rc && grp && strlen(grp) > 0)
84 rc = (grp && Group() && !strcmp(grp, Group())) ? 1 : 0;
85
86 return rc;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Get next free client ID. If none is found, increase the vector size
91/// and get the first new one
92
94{
95 XPDLOC(CMGR, "Client::GetClientID")
96
97 XrdClientID *cid = 0;
98 int ic = 0, sz = 0;
99 { XrdSysMutexHelper mh(fMutex);
100 if (!fIsValid) return -1;
101 // Search for free places in the existing vector
102 for (ic = 0; ic < (int)fClients.size() ; ic++) {
103 if (fClients[ic] && !fClients[ic]->IsValid()) {
104 int rtime = fClients[ic]->ResetTime();
105 if ((rtime >= 0) && ((time(0) - rtime) < fReconnectTimeOut)) {
106 // The session using this cid disconnected too recently, do not reuse yet
107 continue;
108 }
109 cid = fClients[ic];
110 cid->Reset();
111 break;
112 }
113 }
114
115 if (!cid) {
116 // We need to resize (double it)
117 if (ic >= (int)fClients.capacity())
118 fClients.reserve(2*fClients.capacity());
119
120 // Fill in new element
121 cid = new XrdClientID();
122 fClients.push_back(cid);
123 sz = fClients.size();
124 }
125 }
126 // Re-init for this protocol
127 if (cid) {
128 cid->SetP(p);
129 // Reference Stream ID
130 unsigned short sid;
131 memcpy((void *)&sid, (const void *)&(p->Request()->header.streamid[0]), 2);
132 cid->SetSid(sid);
133 }
134
135 TRACE(DBG, "size = "<<sz<<", ic = "<<ic);
136
137 // We are done
138 return ic;
139}
140
141////////////////////////////////////////////////////////////////////////////////
142/// Reserve a client ID. If none is found, increase the vector size
143/// and performe the needed initializations
144
146{
147 XPDLOC(CMGR, "Client::ReserveClientID")
148
149 if (cid < 0)
150 return -1;
151
152 int sz = 0, newsz = 0;
153 { XrdSysMutexHelper mh(fMutex);
154 if (!fIsValid) return -1;
155 if (cid >= (int)fClients.size()) {
156
157 // We need to resize (double it)
158 newsz = fClients.capacity();
159 if (cid >= (int)fClients.capacity()) {
160 newsz = 2 * fClients.capacity();
161 newsz = (cid < newsz) ? newsz : cid + 1;
162 fClients.reserve(newsz);
163 }
164
165 // Fill in new elements
166 while (cid >= (int)fClients.size())
167 fClients.push_back(new XrdClientID());
168 }
169 sz = fClients.size();
170 }
171
172 TRACE(DBG, "cid = "<<cid<<", size = "<<sz<<", capacity = "<<newsz);
173
174 // We are done
175 return 0;
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Get next free server ID. If none is found, increase the vector size
180/// and get the first new one
181
183{
184 XPDLOC(CMGR, "Client::GetFreeServObj")
185
186 int ic = 0, newsz = 0, sz = 0;
187 XrdProofdProofServ *xps = 0;
188 XrdOucString msg;
189 { XrdSysMutexHelper mh(fMutex);
190 if (!fIsValid) return xps;
191
192 // Search for free places in the existing vector
193 for (ic = 0; ic < (int)fProofServs.size() ; ic++) {
194 if (fProofServs[ic] && !(fProofServs[ic]->IsValid())) {
195 fProofServs[ic]->SetValid();
196 break;
197 }
198 }
199
200 // If we did not find it, we resize the vector (double it)
201 if (ic >= (int)fProofServs.capacity()) {
202 newsz = 2 * fProofServs.capacity();
203 fProofServs.reserve(newsz);
204 }
205 if (ic >= (int)fProofServs.size()) {
206 // Allocate new element
207 fProofServs.push_back(new XrdProofdProofServ());
208 }
209 sz = fProofServs.size();
210
211 xps = fProofServs[ic];
212 xps->SetValid();
213 xps->SetID(ic);
214 }
215
216 // Notify
217 if (TRACING(DBG)) {
218 if (newsz > 0) {
219 XPDFORM(msg, "new capacity = %d, size = %d, ic = %d, xps = %p",
220 newsz, sz, ic, xps);
221 } else {
222 XPDFORM(msg, "size = %d, ic = %d, xps = %p", sz, ic, xps);
223 }
224 XPDPRT(msg);
225 }
226
227 // We are done
228 return xps;
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Get server at 'id'. If needed, increase the vector size
233
235{
236 XPDLOC(CMGR, "Client::GetServObj")
237
238 TRACE(DBG, "id: "<< id);
239
240 if (id < 0) {
241 TRACE(XERR, "invalid input: id: "<< id);
242 return (XrdProofdProofServ *)0;
243 }
244
245 XrdOucString dmsg, emsg;
246 XrdProofdProofServ *xps = 0;
247 int siz = 0, cap = 0;
248 { XrdSysMutexHelper mh(fMutex);
249 if (!fIsValid) return xps;
250 siz = fProofServs.size();
251 cap = fProofServs.capacity();
252 }
253 TRACE(DBG, "size = "<<siz<<"; capacity = "<<cap);
254
255 { XrdSysMutexHelper mh(fMutex);
256 if (!fIsValid) return xps;
257 if (id < (int)fProofServs.size()) {
258 if (!(xps = fProofServs[id])) {
259 emsg = "instance in use or undefined! protocol error";
260 }
261 } else {
262 // If we did not find it, we first resize the vector if needed (double it)
263 if (id >= (int)fProofServs.capacity()) {
264 int newsz = 2 * fProofServs.capacity();
265 newsz = (id < newsz) ? newsz : id+1;
266 fProofServs.reserve(newsz);
267 cap = fProofServs.capacity();
268 }
269 int nnew = id - fProofServs.size() + 1;
270 while (nnew--)
271 fProofServs.push_back(new XrdProofdProofServ());
272 xps = fProofServs[id];
273 }
274 }
275 if (xps) {
276 xps->SetID(id);
277 xps->SetValid();
278 }
279 if (TRACING(DBG)) {
280 { XrdSysMutexHelper mh(fMutex);
281 if (fIsValid) {
282 siz = fProofServs.size();
283 cap = fProofServs.capacity();
284 }
285 }
286 TRACE(DBG, "size = "<<siz<<" (capacity = "<<cap<<"); id = "<<id);
287 }
288
289 // We are done
290 return xps;
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Get server instance connected via 'p'
295
297{
298 XPDLOC(CMGR, "Client::GetServer")
299
300 TRACE(DBG, "enter: p: " << p);
301
302
303 XrdProofdProofServ *xps = 0;
304 std::vector<XrdProofdProofServ *>::iterator ip;
305 XrdSysMutexHelper mh(fMutex);
306 if (!fIsValid) return xps;
307 for (ip = fProofServs.begin(); ip != fProofServs.end(); ++ip) {
308 xps = (*ip);
309 if (xps && xps->SrvPID() == p->Pid())
310 break;
311 xps = 0;
312 }
313 // Done
314 return xps;
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Get from the vector server instance with ID psid
319
321{
322 XrdSysMutexHelper mh(fMutex);
323 if (fIsValid && psid > -1 && psid < (int) fProofServs.size())
324 return fProofServs.at(psid);
325 // Done
326 return (XrdProofdProofServ *)0;
327}
328
329////////////////////////////////////////////////////////////////////////////////
330/// Erase server with id psid from the list
331
333{
334 XPDLOC(CMGR, "Client::EraseServer")
335
336 TRACE(DBG, "enter: psid: " << psid);
337
338 XrdProofdProofServ *xps = 0;
339 std::vector<XrdProofdProofServ *>::iterator ip;
340 XrdSysMutexHelper mh(fMutex);
341 if (!fIsValid) return;
342
343 for (ip = fProofServs.begin(); ip != fProofServs.end(); ++ip) {
344 xps = *ip;
345 if (xps && xps->Match(psid)) {
346 // Reset (invalidate)
347 xps->Reset();
348 break;
349 }
350 }
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Return the number of valid proofserv topmaster sessions in the list
355
357{
358 XPDLOC(CMGR, "Client::GetTopServers")
359
360 int nv = 0;
361
362 XrdProofdProofServ *xps = 0;
363 std::vector<XrdProofdProofServ *>::iterator ip;
364 XrdSysMutexHelper mh(fMutex);
365 if (!fIsValid) return nv;
366 for (ip = fProofServs.begin(); ip != fProofServs.end(); ++ip) {
367 if ((xps = *ip) && xps->IsValid() && (xps->SrvType() == kXPD_TopMaster)) {
368 TRACE(DBG,"found potentially valid topmaster session: pid "<<xps->SrvPID());
369 nv++;
370 }
371 }
372
373 // Done
374 return nv;
375}
376
377////////////////////////////////////////////////////////////////////////////////
378/// Reset slot at 'ic'
379
381{
382 XPDLOC(CMGR, "Client::ResetClientSlot")
383
384 TRACE(DBG, "enter: ic: " << ic);
385
386 XrdSysMutexHelper mh(fMutex);
387 if (fIsValid) {
388 if (ic >= 0 && ic < (int) fClients.size()) {
389 fClients[ic]->Reset();
390 return 0;
391 }
392 }
393 // Done
394 return -1;
395}
396
397////////////////////////////////////////////////////////////////////////////////
398/// Return protocol attached to client slot at 'ic'
399
401{
402 XPDLOC(CMGR, "Client::GetProtocol")
403
404 TRACE(DBG, "enter: ic: " << ic);
405
406 XrdProofdProtocol *p = 0;
407
408 XrdSysMutexHelper mh(fMutex);
409 if (fIsValid) {
410 if (ic >= 0 && ic < (int) fClients.size()) {
411 p = fClients[ic]->P();
412 }
413 }
414 // Done
415 return p;
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Set slot cid to instance 'p'
420
422{
423 XPDLOC(CMGR, "Client::SetClientID")
424
425 TRACE(DBG, "cid: "<< cid <<", p: " << p);
426
427 XrdSysMutexHelper mh(fMutex);
428 if (!fIsValid) return -1;
429
430 if (cid >= 0 && cid < (int) fClients.size()) {
431 if (fClients[cid] && (fClients[cid]->P() != p))
432 fClients[cid]->Reset();
433 fClients[cid]->SetP(p);
434 // Reference Stream ID
435 unsigned short sid;
436 memcpy((void *)&sid, (const void *)&(p->Request()->header.streamid[0]), 2);
437 fClients[cid]->SetSid(sid);
438 return 0;
439 }
440
441 // Not found
442 return -1;
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// Broadcast message 'msg' to the connected clients
447
448void XrdProofdClient::Broadcast(const char *msg)
449{
450 XPDLOC(CMGR, "Client::Broadcast")
451
452 int len = 0;
453 if (msg && (len = strlen(msg)) > 0) {
454
455 // Notify the attached clients
456 int ic = 0;
457 XrdClientID *cid = 0;
458 XrdSysMutexHelper mh(fMutex);
459 for (ic = 0; ic < (int) fClients.size(); ic++) {
460 if ((cid = fClients.at(ic)) && cid->P() && cid->P()->ConnType() == kXPD_ClientMaster) {
461
462 if (cid->P()->Link()) {
463 TRACE(ALL," sending to: "<<cid->P()->Link()->ID);
464 XrdProofdResponse *response = cid->R();
465 if (response)
466 response->Send(kXR_attn, kXPD_srvmsg, (char *) msg, len);
467 }
468 }
469 }
470 }
471}
472
473////////////////////////////////////////////////////////////////////////////////
474/// Send a touch the connected clients: this will remotely touch the associated
475/// TSocket instance and schedule an asynchronous touch of the client admin file.
476/// This request is only sent once per client: this is controlled by the flag
477/// fAskedToTouch, whcih can reset to FALSE by calling this function with reset
478/// TRUE.
479/// Return 0 if the request is sent or if asked to reset.
480/// Retunn 1 if the request was already sent.
481
483{
484 // If we are asked to reset, just do that and return
485 if (reset) {
486 fAskedToTouch = 0;
487 return 0;
488 }
489
490 // If already asked to touch say it by return 1
491 if (fAskedToTouch) return 1;
492
493 // Notify the attached clients
494 int ic = 0;
495 XrdClientID *cid = 0;
496 XrdSysMutexHelper mh(fMutex);
497 for (ic = 0; ic < (int) fClients.size(); ic++) {
498 // Do not send to old clients
499 if ((cid = fClients.at(ic)) && cid->P() && cid->P()->ProofProtocol() > 17) {
500 if (cid->P()->ConnType() != kXPD_Internal) {
501 XrdProofdResponse *response = cid->R();
502 if (response) response->Send(kXR_attn, kXPD_touch, (char *)0, 0);
503 }
504 }
505 }
506 // Do it only once a time
507 fAskedToTouch = 1;
508 // Done
509 return 0;
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Quick verification of session 'xps' to avoid attaching clients to
514/// non responding sessions. We do here a sort of loose ping.
515/// Return true is responding, false otherwise.
516
518{
519 XPDLOC(CMGR, "Client::VerifySession")
520
521 if (!xps || !(xps->IsValid())) {
522 TRACE(XERR, " session undefined or invalid");
523 return 0;
524 }
525
526 // Admin path
527 XrdOucString path(xps->AdminPath());
528 if (path.length() <= 0) {
529 TRACE(XERR, "admin path is empty! - protocol error");
530 return 0;
531 }
532 path += ".status";
533
534 // Stat the admin file
535 struct stat st0;
536 if (stat(path.c_str(), &st0) != 0) {
537 TRACE(XERR, "cannot stat admin path: "<<path);
538 return 0;
539 }
540 int now = time(0);
541 if (now >= st0.st_mtime && (now - st0.st_mtime) <= 1) return 1;
542 TRACE(ALL, "admin path: "<<path<<", mtime: "<< st0.st_mtime << ", now: "<< now);
543
544 // Take the pid
545 int pid = xps->SrvPID();
546 // If the session is alive ...
547 if (XrdProofdAux::VerifyProcessByID(pid) != 0) {
548 // Send the request (no further propagation)
549 if (xps->VerifyProofServ(0) != 0) {
550 TRACE(XERR, "could not send verify request to proofsrv");
551 return 0;
552 }
553 // Wait for the action for fgMgr->SessionMgr()->VerifyTimeOut() secs,
554 // checking every 1 sec
555 XrdOucString notmsg;
556 struct stat st1;
557 int ns = 10;
558 while (ns--) {
559 if (stat(path.c_str(), &st1) == 0) {
560 if (st1.st_mtime > st0.st_mtime) {
561 return 1;
562 }
563 }
564 // Wait 1 sec
565 TRACE(HDBG, "waiting "<<ns<<" secs for session "<<pid<<
566 " to touch the admin path");
567 if (r && ns == 5) {
568 XPDFORM(notmsg, "verifying existing sessions, %d seconds ...", ns);
569 r->Send(kXR_attn, kXPD_srvmsg, 0, (char *) notmsg.c_str(), notmsg.length());
570 }
571 sleep(1);
572 }
573 }
574
575 // Verification Failed
576 return 0;
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Skip the next sessions status check. This is used, for example, when
581/// somebody has shown interest in these sessions to give more time for the
582/// reconnection.
583/// If active is defined, the list of active sessions is filled.
584
585void XrdProofdClient::SkipSessionsCheck(std::list<XrdProofdProofServ *> *active,
586 XrdOucString &emsg, XrdProofdResponse *r)
587{
588 XPDLOC(CMGR, "Client::SkipSessionsCheck")
589
590 XrdProofdProofServ *xps = 0;
591 std::vector<XrdProofdProofServ *>::iterator ip;
592 for (ip = fProofServs.begin(); ip != fProofServs.end(); ++ip) {
593 if ((xps = *ip) && xps->IsValid() && (xps->SrvType() == kXPD_TopMaster)) {
594 if (VerifySession(xps, r)) {
595 xps->SetSkipCheck(); // Skip next validity check
596 if (active) active->push_back(xps);
597 } else {
598 if (xps->SrvPID() > 0) {
599 if (emsg.length() <= 0)
600 emsg = "ignoring (apparently) non-responding session(s): ";
601 else
602 emsg += " ";
603 emsg += xps->SrvPID();
604 }
605 TRACE(ALL,"session "<<xps->SrvPID()<<" does not react: dead?");
606 }
607 }
608 }
609 if (active)
610 TRACE(HDBG, "found: " << active->size() << " sessions");
611
612 // Over
613 return;
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// Return a string describing the existing sessions
618
619XrdOucString XrdProofdClient::ExportSessions(XrdOucString &emsg,
621{
622 XrdOucString out, buf;
623
624 // Protect from next session check and get the list of actives
625 std::list<XrdProofdProofServ *> active;
626 SkipSessionsCheck(&active, emsg, r);
627
628 // Fill info
629 XrdProofdProofServ *xps = 0;
630 out += (int) active.size();
631 std::list<XrdProofdProofServ *>::iterator ia;
632 for (ia = active.begin(); ia != active.end(); ++ia) {
633 if ((xps = *ia) && xps->IsValid()) {
634 xps->ExportBuf(buf);
635 out += buf;
636 }
637 }
638
639 // Over
640 return out;
641}
642
643////////////////////////////////////////////////////////////////////////////////
644/// Terminate client sessions; IDs of signalled processes are added to sigpid.
645
647 const char *msg, XrdProofdPipe *pipe,
648 bool changeown)
649{
650 XPDLOC(CMGR, "Client::TerminateSessions")
651
652 // Loop over client sessions and terminated them
653 int is = 0;
654 XrdProofdProofServ *s = 0;
655 for (is = 0; is < (int) fProofServs.size(); is++) {
656 if ((s = fProofServs.at(is)) && s->IsValid() && (!ref || ref == s) &&
657 (s->SrvType() == srvtype || (srvtype == kXPD_AnyServer))) {
658 TRACE(DBG, "terminating " << s->SrvPID());
659
660 if (srvtype == kXPD_TopMaster && msg && strlen(msg) > 0)
661 // Tell other attached clients, if any, that this session is gone
662 Broadcast(msg);
663
664 // Sendout a termination signal
666
667 // Record this session in the sandbox as old session
668 XrdOucString tag = "-";
669 tag += s->SrvPID();
670 if (fSandbox.GuessTag(tag, 1) == 0)
671 fSandbox.RemoveSession(tag.c_str());
672
673 // Tell the session manager that the session is gone
674 if (pipe) {
675 int rc = 0;
676 XrdOucString buf(s->AdminPath());
677 buf.erase(0, buf.rfind('/') + 1);
678 TRACE(DBG,"posting kSessionRemoval with: '"<<buf<<"'");
679 if ((rc = pipe->Post(XrdProofdProofServMgr::kSessionRemoval, buf.c_str())) != 0) {
680 TRACE(XERR, "problem posting the pipe; errno: "<<-rc);
681 }
682 }
683
684 // Reset this session
685 s->Reset();
686 }
687 }
688}
689
690////////////////////////////////////////////////////////////////////////////////
691/// Reset this instance
692
694{
695 fAskedToTouch = 0;
696
697 XrdSysMutexHelper mh(fMutex);
698 std::vector<XrdProofdProofServ *>::iterator ip;
699 for (ip = fProofServs.begin(); ip != fProofServs.end(); ++ip) {
700 // Reset (invalidate) the server instance
701 if (*ip) (*ip)->Reset();
702 }
703}
704
ROOT::R::TRInterface & r
Definition Object.C:4
#define TRACE(Flag, Args)
Definition TGHtml.h:120
XFontStruct * id
Definition TGX11.cxx:109
R__EXTERN C unsigned int sleep(unsigned int seconds)
#define kXPD_ClientMaster
#define kXPD_TopMaster
#define kXPD_AnyServer
#define kXPD_Internal
@ kXPD_touch
@ kXPD_srvmsg
#define XPDFORM
#define XPDPRT(x)
#define XPDLOC(d, x)
#define TRACING(x)
XrdProofdResponse * R() const
void SetP(XrdProofdProtocol *p)
XrdProofdProtocol * P() const
void SetSid(unsigned short sid)
XrdOucString fUser
XrdOucString fGroup
static int GetUserInfo(const char *usr, XrdProofUI &ui)
Get information about user 'usr' in a thread safe way.
static int AssertDir(const char *path, XrdProofUI ui, bool changeown)
Make sure that 'path' exists and is owned by the entity described by 'ui'.
static int VerifyProcessByID(int pid, const char *pname="proofserv")
Check if a process named 'pname' and process 'pid' is still in the process table.
std::vector< XrdClientID * > fClients
virtual ~XrdProofdClient()
Destructor.
bool IsValid() const
void TerminateSessions(int srvtype, XrdProofdProofServ *ref, const char *msg, XrdProofdPipe *pipe, bool changeown)
Terminate client sessions; IDs of signalled processes are added to sigpid.
int ReserveClientID(int cid)
Reserve a client ID.
int GetTopServers()
Return the number of valid proofserv topmaster sessions in the list.
XrdProofdProofServ * GetFreeServObj()
Get next free server ID.
int GetClientID(XrdProofdProtocol *p)
Get next free client ID.
XrdOucString ExportSessions(XrdOucString &emsg, XrdProofdResponse *r=0)
Return a string describing the existing sessions.
const char * Group() const
const char * User() const
int ResetClientSlot(int ic)
Reset slot at 'ic'.
void Broadcast(const char *msg)
Broadcast message 'msg' to the connected clients.
XrdOucString fAdminPath
XrdSysRecMutex fMutex
bool VerifySession(XrdProofdProofServ *xps, XrdProofdResponse *r=0)
Quick verification of session 'xps' to avoid attaching clients to non responding sessions.
void ResetSessions()
Reset this instance.
XrdProofdProofServ * GetServer(int psid)
Get from the vector server instance with ID psid.
std::vector< XrdProofdProofServ * > fProofServs
int Touch(bool reset=0)
Send a touch the connected clients: this will remotely touch the associated TSocket instance and sche...
void EraseServer(int psid)
Erase server with id psid from the list.
XrdProofdProofServ * GetServObj(int id)
Get server at 'id'. If needed, increase the vector size.
int SetClientID(int cid, XrdProofdProtocol *p)
Set slot cid to instance 'p'.
XrdProofdSandbox fSandbox
XrdProofdProtocol * GetProtocol(int ic)
Return protocol attached to client slot at 'ic'.
bool Match(const char *usr, const char *grp=0)
return TRUE if this instance matches 'id' (and 'grp', if defined)
void SkipSessionsCheck(std::list< XrdProofdProofServ * > *active, XrdOucString &emsg, XrdProofdResponse *r=0)
Skip the next sessions status check.
XrdProofdClient(XrdProofUI ui, bool master, bool changeown, XrdSysError *edest, const char *tmp, int rtime)
Constructor.
int Post(int type, const char *msg)
Post message on the pipe.
void SetValid(bool valid=1)
const char * AdminPath() const
void SetID(short int id)
void ExportBuf(XrdOucString &buf)
Fill buf with relevant info about this session.
int VerifyProofServ(bool fw)
Check if the associated proofserv process is alive.
int TerminateProofServ(bool changeown)
Terminate the associated process.
bool Match(short int id) const
void Reset()
Reset this instance.
XrdLink * Link() const
short int ProofProtocol() const
XPClientRequest * Request() const
int Send(void)
Auxilliary Send method.
int GuessTag(XrdOucString &tag, int ridx=1)
Guess session tag completing 'tag' (typically "-<pid>") by scanning the active session file or the se...
bool IsValid() const
int RemoveSession(const char *tag)
Move record for tag from the active sessions file to the old sessions file (<SandBox>/....
int changeown(const std::string &path, uid_t u, gid_t g)
Change the ownership of 'path' to the entity described by {u,g}.
struct ClientRequestHdr header