XRootD
XrdFrmXfrDaemon Class Reference

#include <XrdFrmXfrDaemon.hh>

+ Collaboration diagram for XrdFrmXfrDaemon:

Public Member Functions

 XrdFrmXfrDaemon ()
 
 ~XrdFrmXfrDaemon ()
 

Static Public Member Functions

static int Init ()
 
static void Pong ()
 
static int Start ()
 

Detailed Description

Definition at line 35 of file XrdFrmXfrDaemon.hh.

Constructor & Destructor Documentation

◆ XrdFrmXfrDaemon()

XrdFrmXfrDaemon::XrdFrmXfrDaemon ( )
inline

Definition at line 45 of file XrdFrmXfrDaemon.hh.

45 {}

◆ ~XrdFrmXfrDaemon()

XrdFrmXfrDaemon::~XrdFrmXfrDaemon ( )
inline

Definition at line 46 of file XrdFrmXfrDaemon.hh.

46 {}

Member Function Documentation

◆ Init()

int XrdFrmXfrDaemon::Init ( )
static

Definition at line 95 of file XrdFrmXfrDaemon.cc.

96 {
97  char buff[80];
98 
99 // Make sure we are the only daemon running
100 //
101  sprintf(buff, "%s/frm_xfrd.lock", Config.QPath);
102  if (!XrdFrcUtils::Unique(buff, Config.myProg)) return 0;
103 
104 // Initiliaze the transfer processor (it need to be active now)
105 //
106  if (!XrdFrmTransfer::Init()) return 0;
107 
108 // Fix up some values that might not make sense
109 //
110  if (Config.WaitMigr < Config.IdleHold) Config.WaitMigr = Config.IdleHold;
111 
112 // Check if it makes any sense to migrate and, if so, initialize migration
113 //
114  if (Config.pathList)
115  {if (!Config.xfrOUT)
116  Say.Emsg("Config","Output copy command not specified; "
117  "auto-migration disabled!");
118  else XrdFrmMigrate::Migrate();
119  } else Say.Emsg("Config","No migratable paths; "
120  "auto-migration disabled!");
121 
122 // Start the external interfaces
123 //
124  if (!StgBoss.Start(Config.QPath, Config.AdminMode)
125  || !MigBoss.Start(Config.QPath, Config.AdminMode)
126  || !GetBoss.Start(Config.QPath, Config.AdminMode)
127  || !PutBoss.Start(Config.QPath, Config.AdminMode)) return 0;
128 
129 // All done
130 //
131  return 1;
132 }
const char * myProg
static int Unique(const char *lkfn, const char *myProg)
Definition: XrdFrcUtils.cc:241
static void Migrate(int doinit=1)
int Start(char *aPath, int aMode)
static int Init()
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysError Say
XrdCmsConfig Config

References XrdCms::Config, XrdSysError::Emsg(), XrdFrmTransfer::Init(), XrdFrmMigrate::Migrate(), XrdCmsConfig::myProg, XrdFrc::Say, and XrdFrcUtils::Unique().

Referenced by mainConfig().

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

◆ Pong()

void XrdFrmXfrDaemon::Pong ( )
static

Definition at line 145 of file XrdFrmXfrDaemon.cc.

146 {
147  EPNAME("Pong");
148  static int udpFD = -1;
149  XrdOucStream Request(&Say);
150  XrdFrmReqBoss *bossP;
151  char *tp;
152 
153 // Get a UDP socket for the server if we haven't already done so and start
154 // a thread to re-enter this code and wait for messages from an agent.
155 //
156  if (udpFD < 0)
157  {XrdNetSocket *udpSock;
158  pthread_t tid;
159  int retc;
160  if ((udpSock = XrdNetSocket::Create(&Say, Config.QPath,
161  "xfrd.udp", Config.AdminMode, XRDNET_UDPSOCKET)))
162  {udpFD = udpSock->Detach(); delete udpSock;
163  if ((retc = XrdSysThread::Run(&tid, XrdFrmXfrDaemonPong, (void *)0,
164  XRDSYSTHREAD_BIND, "Pong")))
165  Say.Emsg("main", retc, "create udp listner");
166  }
167  return;
168  }
169 
170 // Hookup to the udp socket as a stream
171 //
172  Request.Attach(udpFD, 64*1024);
173 
174 // Now simply get requests (see XrdFrmXfrDaemon for details). Here we screen
175 // out ping and list requests.
176 //
177  while((tp = Request.GetLine()))
178  {DEBUG(": '" <<tp <<"'");
179  switch(*tp)
180  {case '?': break;
181  case '!': if ((tp = Request.GetToken()))
182  while(*tp++)
183  {if ((bossP = Boss(*tp))) bossP->Wakeup(1);}
184  break;
185  default: XrdFrmXfrAgent::Process(Request);
186  }
187  }
188 
189 // We should never get here (but....)
190 //
191  Say.Emsg("Server", "Lost udp connection!");
192 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
void * XrdFrmXfrDaemonPong(void *parg)
#define XRDNET_UDPSOCKET
Definition: XrdNetOpts.hh:79
#define XRDSYSTHREAD_BIND
void Wakeup(int PushIt=1)
static void Process(XrdOucStream &Request)
static XrdNetSocket * Create(XrdSysError *Say, const char *path, const char *fn, mode_t mode, int isudp=0)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)

References XrdOucStream::Attach(), XrdCms::Config, XrdNetSocket::Create(), DEBUG, XrdNetSocket::Detach(), XrdSysError::Emsg(), EPNAME, XrdOucStream::GetLine(), XrdOucStream::GetToken(), XrdFrmXfrAgent::Process(), XrdSysThread::Run(), XrdFrc::Say, XrdFrmReqBoss::Wakeup(), XrdFrmXfrDaemonPong(), XRDNET_UDPSOCKET, and XRDSYSTHREAD_BIND.

Referenced by XrdFrmXfrDaemonPong().

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

◆ Start()

int XrdFrmXfrDaemon::Start ( )
static

Definition at line 198 of file XrdFrmXfrDaemon.cc.

199 {
200 
201 // Start the ponger
202 //
203  Pong();
204 
205 // Now start nudging
206 //
207  while(1)
208  {StgBoss.Wakeup(); GetBoss.Wakeup();
209  MigBoss.Wakeup(); PutBoss.Wakeup();
210  XrdSysTimer::Snooze(Config.WaitQChk);
211  }
212 
213 // We should never get here
214 //
215  return 0;
216 }
static void Pong()
static void Snooze(int seconds)
Definition: XrdSysTimer.cc:168

References XrdCms::Config, and XrdSysTimer::Snooze().

Referenced by main().

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

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