XRootD
XrdLinkXeq Class Reference

#include <XrdLinkXeq.hh>

+ Inheritance diagram for XrdLinkXeq:
+ Collaboration diagram for XrdLinkXeq:

Public Member Functions

 XrdLinkXeq ()
 
 ~XrdLinkXeq ()
 
XrdNetAddrInfoAddrInfo ()
 
int Backlog ()
 
int Client (char *buff, int blen)
 
int Close (bool defer=false)
 
void DoIt ()
 
int getIOStats (long long &inbytes, long long &outbytes, int &numstall, int &numtardy)
 
XrdTlsPeerCertsgetPeerCerts ()
 
XrdProtocolgetProtocol ()
 
const char * Name () const
 
const XrdNetAddrNetAddr () const
 
int Peek (char *buff, int blen, int timeout=-1)
 
int Recv (char *buff, int blen)
 
int Recv (char *buff, int blen, int timeout)
 
int Recv (const struct iovec *iov, int iocnt, int timeout)
 
int RecvAll (char *buff, int blen, int timeout=-1)
 
bool Register (const char *hName)
 
int Send (const char *buff, int blen)
 
int Send (const sfVec *sdP, int sdn)
 
int Send (const struct iovec *iov, int iocnt, int bytes=0)
 
void setID (const char *userid, int procid)
 
void setLocation (XrdNetAddrInfo::LocInfo &loc)
 
bool setNB ()
 
void setProtName (const char *name)
 
XrdProtocolsetProtocol (XrdProtocol *pp, bool push)
 
bool setTLS (bool enable, XrdTlsContext *ctx=0)
 
void Shutdown (bool getLock)
 
void syncStats (int *ctime=0)
 
int TLS_Peek (char *Buff, int Blen, int timeout)
 
int TLS_Recv (char *Buff, int Blen)
 
int TLS_Recv (char *Buff, int Blen, int timeout, bool havelock=false)
 
int TLS_Recv (const struct iovec *iov, int iocnt, int timeout)
 
int TLS_RecvAll (char *Buff, int Blen, int timeout)
 
int TLS_Send (const char *Buff, int Blen)
 
int TLS_Send (const sfVec *sfP, int sfN)
 
int TLS_Send (const struct iovec *iov, int iocnt, int bytes)
 
const char * verTLS ()
 

Static Public Member Functions

static int getName (int &curr, char *bname, int blen, XrdLinkMatch *who=0)
 
static int Stats (char *buff, int blen, bool do_sync=false)
 

Public Attributes

XrdLinkInfo LinkInfo
 
XrdPollInfo PollInfo
 

Protected Member Functions

int RecvIOV (const struct iovec *iov, int iocnt)
 
void Reset ()
 
int sendData (const char *Buff, int Blen)
 
int SendIOV (const struct iovec *iov, int iocnt, int bytes)
 
int SFError (int rc)
 
int TLS_Error (const char *act, XrdTls::RC rc)
 
bool TLS_Write (const char *Buff, int Blen)
 
- Protected Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 

Protected Attributes

XrdNetAddr Addr
 
long long BytesIn
 
long long BytesInTot
 
long long BytesOut
 
long long BytesOutTot
 
int HNlen
 
char isIdle
 
bool KeepFD
 
char Lname [256]
 
bool LockReads
 
XrdProtocolProtoAlt
 
XrdProtocolProtocol
 
XrdSysMutex rdMutex
 
XrdSendQsendQ
 
int SfIntr
 
int stallCnt
 
int stallCntTot
 
int tardyCnt
 
int tardyCntTot
 
XrdTlsSocket tlsIO
 
char Uname [24]
 
XrdSysMutex wrMutex
 
- Protected Attributes inherited from XrdJob
const char * Comment
 
XrdJobNextJob
 

Static Protected Attributes

static long long LinkBytesIn = 0
 
static long long LinkBytesOut = 0
 
static long long LinkConTime = 0
 
static int LinkCount = 0
 
static int LinkCountMax = 0
 
static long long LinkCountTot = 0
 
static int LinkSfIntr = 0
 
static int LinkStalls = 0
 
static int LinkTimeOuts = 0
 
static XrdSysMutex statsMutex
 
static const char * TraceID = "LinkXeq"
 

Additional Inherited Members

Detailed Description

Definition at line 52 of file XrdLinkXeq.hh.

Constructor & Destructor Documentation

◆ XrdLinkXeq()

XrdLinkXeq::XrdLinkXeq ( )

Definition at line 124 of file XrdLinkXeq.cc.

124  : XrdLink(*this), PollInfo((XrdLink &)*this)
125 {
127 }
void Reset()
Definition: XrdLinkXeq.cc:129
XrdPollInfo PollInfo
Definition: XrdLinkXeq.hh:145

References Reset().

+ Here is the call graph for this function:

◆ ~XrdLinkXeq()

XrdLinkXeq::~XrdLinkXeq ( )
inline

Definition at line 142 of file XrdLinkXeq.hh.

142 {} // Is never deleted!

Member Function Documentation

◆ AddrInfo()

XrdNetAddrInfo* XrdLinkXeq::AddrInfo ( )
inline

Definition at line 57 of file XrdLinkXeq.hh.

57 {return (XrdNetAddrInfo *)&Addr;}
XrdNetAddr Addr
Definition: XrdLinkXeq.hh:192

References Addr.

Referenced by XrdLink::AddrInfo().

+ Here is the caller graph for this function:

◆ Backlog()

int XrdLinkXeq::Backlog ( )

Definition at line 155 of file XrdLinkXeq.cc.

156 {
158 
159 // Return backlog information
160 //
161  return (sendQ ? sendQ->Backlog() : 0);
162 }
XrdSysMutex wrMutex
Definition: XrdLinkXeq.hh:194
XrdSendQ * sendQ
Definition: XrdLinkXeq.hh:195
unsigned int Backlog()
Definition: XrdSendQ.hh:46

References XrdSendQ::Backlog(), sendQ, and wrMutex.

Referenced by XrdLink::Backlog().

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

◆ Client()

int XrdLinkXeq::Client ( char *  buff,
int  blen 
)

Definition at line 168 of file XrdLinkXeq.cc.

169 {
170  int ulen;
171 
172 // Generate full client name
173 //
174  if (nbsz <= 0) return 0;
175  ulen = (Lname - ID);
176  if ((ulen + HNlen) >= nbsz) ulen = 0;
177  else {strncpy(nbuf, ID, ulen);
178  strcpy(nbuf+ulen, HostName);
179  ulen += HNlen;
180  }
181  return ulen;
182 }
char Lname[256]
Definition: XrdLinkXeq.hh:201

References HNlen, XrdLink::HostName, XrdLink::ID, and Lname.

Referenced by XrdLink::Client(), and XrdLinkCtl::getName().

+ Here is the caller graph for this function:

◆ Close()

int XrdLinkXeq::Close ( bool  defer = false)

Definition at line 188 of file XrdLinkXeq.cc.

190  int csec, fd, rc = 0;
191 
192 // If a defer close is requested, we can close the descriptor but we must
193 // keep the slot number to prevent a new client getting the same fd number.
194 // Linux is peculiar in that any in-progress operations will remain in that
195 // state even after the FD is closed unless there is some activity either on
196 // the connection or an event occurs that causes an operation restart. We
197 // portably solve this problem by issuing a shutdown() on the socket prior
198 // closing it. On most platforms, this informs readers that the connection is
199 // gone (though not on old (i.e. <= 2.3) versions of Linux, sigh). Also, if
200 // nonblocking mode is enabled, we need to do this in a separate thread as
201 // a shutdown may block for a pretty long time if lots\ of messages are queued.
202 // We will ask the SendQ object to schedule the shutdown for us before it
203 // commits suicide.
204 // Note that we can hold the opMutex while we also get the wrMutex.
205 //
206  if (defer)
207  {if (!sendQ) Shutdown(false);
208  else {TRACEI(DEBUG, "Shutdown FD " <<LinkInfo.FD<<" only via SendQ");
209  LinkInfo.InUse++;
210  LinkInfo.FD = -LinkInfo.FD; // Leave poll version untouched!
211  wrMutex.Lock();
212  sendQ->Terminate(this);
213  sendQ = 0;
214  wrMutex.UnLock();
215  }
216  return 0;
217  }
218 
219 // If we got here then this is not a deferred close so we just need to check
220 // if there is a sendq appendage we need to get rid of.
221 //
222  if (sendQ)
223  {wrMutex.Lock();
224  sendQ->Terminate();
225  sendQ = 0;
226  wrMutex.UnLock();
227  }
228 
229 // Multiple protocols may be bound to this link. If it is in use, defer the
230 // actual close until the use count drops to one.
231 //
232  while(LinkInfo.InUse > 1)
233  {opHelper.UnLock();
234  TRACEI(DEBUG, "Close FD "<<LinkInfo.FD <<" deferred, use count="
235  <<LinkInfo.InUse);
236  Serialize();
237  opHelper.Lock(&LinkInfo.opMutex);
238  }
239  LinkInfo.InUse--;
240  Instance = 0;
241 
242 // Add up the statistic for this link
243 //
244  syncStats(&csec);
245 
246 // Cleanup TLS if it is active
247 //
248  if (isTLS) tlsIO.Shutdown();
249 
250 // Clean this link up
251 //
252  if (Protocol) {Protocol->Recycle(this, csec, LinkInfo.Etext); Protocol = 0;}
253  if (ProtoAlt) {ProtoAlt->Recycle(this, csec, LinkInfo.Etext); ProtoAlt = 0;}
254  if (LinkInfo.Etext) {free(LinkInfo.Etext); LinkInfo.Etext = 0;}
255  LinkInfo.InUse = 0;
256 
257 // At this point we can have no lock conflicts, so if someone is waiting for
258 // us to terminate let them know about it. Note that we will get the condvar
259 // mutex while we hold the opMutex. This is the required order! We will also
260 // zero out the pointer to the condvar while holding the opmutex.
261 //
262  if (LinkInfo.KillcvP)
263  {LinkInfo.KillcvP->Lock();
266  LinkInfo.KillcvP = 0;
267  }
268 
269 // Remove ourselves from the poll table and then from the Link table. We may
270 // not hold on to the opMutex when we acquire the LTMutex. However, the link
271 // table needs to be cleaned up prior to actually closing the socket. So, we
272 // do some fancy footwork to prevent multiple closes of this link.
273 //
274  fd = abs(LinkInfo.FD);
275  if (PollInfo.FD > 0)
277  PollInfo.FD = -1;
278  opHelper.UnLock();
279  XrdLinkCtl::Unhook(fd);
280  } else opHelper.UnLock();
281 
282 // Invoke the TCP monitor if it was loaded.
283 //
284  if (TcpMonPin && fd > 2)
285  {XrdTcpMonPin::LinkInfo lnkInfo;
286  lnkInfo.tident = ID;
287  lnkInfo.fd = fd;
288  lnkInfo.consec = csec;
289  lnkInfo.bytesIn = BytesInTot;
290  lnkInfo.bytesOut = BytesOutTot;
291  TcpMonPin->Monitor(Addr, lnkInfo, sizeof(lnkInfo));
292  }
293 
294 // Close the file descriptor if it isn't being shared. Do it as the last
295 // thing because closes and accepts and not interlocked.
296 //
297  if (fd >= 2) {if (KeepFD) rc = 0;
298  else rc = (close(fd) < 0 ? errno : 0);
299  }
300  if (rc) Log.Emsg("Link", rc, "close", ID);
301  return rc;
302 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define close(a)
Definition: XrdPosix.hh:43
#define TRACEI(act, x)
Definition: XrdTrace.hh:66
static void Unhook(int fd)
Unhook a link from the active table of links.
Definition: XrdLinkCtl.cc:392
char * Etext
Definition: XrdLinkInfo.hh:45
XrdSysRecMutex opMutex
Definition: XrdLinkInfo.hh:46
XrdSysCondVar * KillcvP
Definition: XrdLinkInfo.hh:42
XrdLinkInfo LinkInfo
Definition: XrdLinkXeq.hh:144
XrdProtocol * ProtoAlt
Definition: XrdLinkXeq.hh:184
long long BytesInTot
Definition: XrdLinkXeq.hh:171
long long BytesOutTot
Definition: XrdLinkXeq.hh:173
void Shutdown(bool getLock)
Definition: XrdLinkXeq.cc:1050
XrdTlsSocket tlsIO
Definition: XrdLinkXeq.hh:188
XrdProtocol * Protocol
Definition: XrdLinkXeq.hh:183
void syncStats(int *ctime=0)
Definition: XrdLinkXeq.cc:1118
XrdPoll * Poller
Definition: XrdPollInfo.hh:43
static void Detach(XrdPollInfo &pInfo)
Definition: XrdPoll.cc:177
virtual void Recycle(XrdLink *lp=0, int consec=0, const char *reason=0)=0
void Terminate(XrdLink *lP=0)
Definition: XrdSendQ.cc:396
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
int fd
Socket file descriptor.
Definition: XrdTcpMonPin.hh:61
long long bytesOut
Bytes written to the socket.
Definition: XrdTcpMonPin.hh:64
int consec
Seconds connected.
Definition: XrdTcpMonPin.hh:62
virtual void Monitor(XrdNetAddrInfo &netInfo, LinkInfo &lnkInfo, int liLen)=0
long long bytesIn
Bytes read from the socket.
Definition: XrdTcpMonPin.hh:63
const char * tident
Pointer to the client's trace identifier.
Definition: XrdTcpMonPin.hh:60
void Shutdown(SDType=sdImmed)
XrdTcpMonPin * TcpMonPin
Definition: XrdLinkXeq.cc:96
XrdSysError Log
Definition: XrdConfig.cc:111

References Addr, XrdTcpMonPin::LinkInfo::bytesIn, BytesInTot, XrdTcpMonPin::LinkInfo::bytesOut, BytesOutTot, close, XrdTcpMonPin::LinkInfo::consec, DEBUG, XrdPoll::Detach(), XrdSysError::Emsg(), XrdLinkInfo::Etext, XrdLinkInfo::FD, XrdPollInfo::FD, XrdTcpMonPin::LinkInfo::fd, XrdLink::ID, XrdLink::Instance, XrdLinkInfo::InUse, XrdLink::isTLS, KeepFD, XrdLinkInfo::KillcvP, LinkInfo, XrdSysCondVar::Lock(), XrdSysMutex::Lock(), XrdSysMutexHelper::Lock(), XrdGlobal::Log, XrdTcpMonPin::Monitor(), XrdLinkInfo::opMutex, XrdPollInfo::Poller, PollInfo, ProtoAlt, Protocol, XrdProtocol::Recycle(), sendQ, XrdLink::Serialize(), Shutdown(), XrdTlsSocket::Shutdown(), XrdSysCondVar::Signal(), syncStats(), XrdGlobal::TcpMonPin, XrdSendQ::Terminate(), XrdTcpMonPin::LinkInfo::tident, tlsIO, TRACEI, XrdLinkCtl::Unhook(), XrdSysCondVar::UnLock(), XrdSysMutex::UnLock(), XrdSysMutexHelper::UnLock(), and wrMutex.

Referenced by XrdLink::Close(), and DoIt().

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

◆ DoIt()

void XrdLinkXeq::DoIt ( )
virtual

Reimplemented from XrdLink.

Definition at line 308 of file XrdLinkXeq.cc.

309 {
310  int rc;
311 
312 // The Process() return code tells us what to do:
313 // < 0 -> Stop getting requests,
314 // -EINPROGRESS leave link disabled but otherwise all is well
315 // -n Error, disable and close the link
316 // = 0 -> OK, get next request, if allowed, o/w enable the link
317 // > 0 -> Slow link, stop getting requests and enable the link
318 //
319  if (Protocol)
320  do {rc = Protocol->Process(this);} while (!rc && Sched.canStick());
321  else {Log.Emsg("Link", "Dispatch on closed link", ID);
322  return;
323  }
324 
325 // Either re-enable the link and cycle back waiting for a new request, leave
326 // disabled, or terminate the connection.
327 //
328  if (rc >= 0)
330  else if (rc != -EINPROGRESS) Close();
331 }
int Close(bool defer=false)
Definition: XrdLinkXeq.cc:188
virtual int Enable(XrdPollInfo &pInfo)=0
virtual int Process(XrdLink *lp)=0
XrdScheduler Sched
Definition: XrdLinkCtl.cc:54

References XrdScheduler::canStick(), Close(), XrdSysError::Emsg(), XrdPoll::Enable(), XrdLink::ID, XrdGlobal::Log, XrdPollInfo::Poller, PollInfo, XrdProtocol::Process(), Protocol, and XrdGlobal::Sched.

+ Here is the call graph for this function:

◆ getIOStats()

int XrdLinkXeq::getIOStats ( long long &  inbytes,
long long &  outbytes,
int &  numstall,
int &  numtardy 
)
inline

Definition at line 68 of file XrdLinkXeq.hh.

70  { inbytes = BytesIn + BytesInTot;
71  outbytes = BytesOut+BytesOutTot;
72  numstall = stallCnt + stallCntTot;
73  numtardy = tardyCnt + tardyCntTot;
74  return LinkInfo.InUse;
75  }
long long BytesOut
Definition: XrdLinkXeq.hh:172
int stallCntTot
Definition: XrdLinkXeq.hh:175
long long BytesIn
Definition: XrdLinkXeq.hh:170
int tardyCntTot
Definition: XrdLinkXeq.hh:177

References BytesIn, BytesInTot, BytesOut, BytesOutTot, XrdLinkInfo::InUse, LinkInfo, stallCnt, stallCntTot, tardyCnt, and tardyCntTot.

Referenced by XrdLink::getIOStats().

+ Here is the caller graph for this function:

◆ getName()

static int XrdLinkXeq::getName ( int &  curr,
char *  bname,
int  blen,
XrdLinkMatch who = 0 
)
static

◆ getPeerCerts()

XrdTlsPeerCerts * XrdLinkXeq::getPeerCerts ( )

Definition at line 337 of file XrdLinkXeq.cc.

338 {
339  return (isTLS ? tlsIO.getCerts(true) : 0);
340 }
XrdTlsPeerCerts * getCerts(bool ver=true)

References XrdTlsSocket::getCerts(), XrdLink::isTLS, and tlsIO.

Referenced by XrdLink::getPeerCerts().

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

◆ getProtocol()

XrdProtocol* XrdLinkXeq::getProtocol ( )
inline

Definition at line 82 of file XrdLinkXeq.hh.

82 {return Protocol;}

References Protocol.

Referenced by XrdLink::getProtocol(), and XrdLink::Terminate().

+ Here is the caller graph for this function:

◆ Name()

const char* XrdLinkXeq::Name ( ) const
inline

Definition at line 85 of file XrdLinkXeq.hh.

85 {return (const char *)Lname;}

References Lname.

Referenced by XrdLink::Name().

+ Here is the caller graph for this function:

◆ NetAddr()

const XrdNetAddr* XrdLinkXeq::NetAddr ( ) const
inline

Definition at line 88 of file XrdLinkXeq.hh.

88 {return &Addr;}

References Addr.

Referenced by XrdLink::NetAddr().

+ Here is the caller graph for this function:

◆ Peek()

int XrdLinkXeq::Peek ( char *  buff,
int  blen,
int  timeout = -1 
)

Definition at line 346 of file XrdLinkXeq.cc.

347 {
348  XrdSysMutexHelper theMutex;
349  struct pollfd polltab = {PollInfo.FD, POLLIN|POLLRDNORM, 0};
350  ssize_t mlen;
351  int retc;
352 
353 // Lock the read mutex if we need to, the helper will unlock it upon exit
354 //
355  if (LockReads) theMutex.Lock(&rdMutex);
356 
357 // Wait until we can actually read something
358 //
359  isIdle = 0;
360  do {retc = poll(&polltab, 1, timeout);} while(retc < 0 && errno == EINTR);
361  if (retc != 1)
362  {if (retc == 0) return 0;
363  return Log.Emsg("Link", -errno, "poll", ID);
364  }
365 
366 // Verify it is safe to read now
367 //
368  if (!(polltab.revents & (POLLIN|POLLRDNORM)))
369  {Log.Emsg("Link", XrdPoll::Poll2Text(polltab.revents), "polling", ID);
370  return -1;
371  }
372 
373 // Do the peek.
374 //
375  do {mlen = recv(LinkInfo.FD, Buff, Blen, MSG_PEEK);}
376  while(mlen < 0 && errno == EINTR);
377 
378 // Return the result
379 //
380  if (mlen >= 0) return int(mlen);
381  Log.Emsg("Link", errno, "peek on", ID);
382  return -1;
383 }
bool LockReads
Definition: XrdLinkXeq.hh:197
XrdSysMutex rdMutex
Definition: XrdLinkXeq.hh:193
static char * Poll2Text(short events)
Definition: XrdPoll.cc:272
void Lock(XrdSysMutex *Mutex)

References XrdSysError::Emsg(), XrdLinkInfo::FD, XrdPollInfo::FD, XrdLink::ID, isIdle, LinkInfo, XrdSysMutexHelper::Lock(), LockReads, XrdGlobal::Log, XrdPoll::Poll2Text(), PollInfo, and rdMutex.

Referenced by XrdLink::Peek().

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

◆ Recv() [1/3]

int XrdLinkXeq::Recv ( char *  buff,
int  blen 
)

Definition at line 389 of file XrdLinkXeq.cc.

390 {
391  ssize_t rlen;
392 
393 // Note that we will read only as much as is queued. Use Recv() with a
394 // timeout to receive as much data as possible.
395 //
396  if (LockReads) rdMutex.Lock();
397  isIdle = 0;
398  do {rlen = read(LinkInfo.FD, Buff, Blen);} while(rlen < 0 && errno == EINTR);
399  if (rlen > 0) AtomicAdd(BytesIn, rlen);
400  if (LockReads) rdMutex.UnLock();
401 
402  if (rlen >= 0) return int(rlen);
403  if (LinkInfo.FD >= 0) Log.Emsg("Link", errno, "receive from", ID);
404  return -1;
405 }
ssize_t read(int fildes, void *buf, size_t nbyte)
#define AtomicAdd(x, y)

References AtomicAdd, BytesIn, XrdSysError::Emsg(), XrdLinkInfo::FD, XrdLink::ID, isIdle, LinkInfo, XrdSysMutex::Lock(), LockReads, XrdGlobal::Log, rdMutex, read(), and XrdSysMutex::UnLock().

Referenced by XrdLink::Recv().

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

◆ Recv() [2/3]

int XrdLinkXeq::Recv ( char *  buff,
int  blen,
int  timeout 
)

Definition at line 409 of file XrdLinkXeq.cc.

410 {
411  XrdSysMutexHelper theMutex;
412  struct pollfd polltab = {PollInfo.FD, POLLIN|POLLRDNORM, 0};
413  ssize_t rlen, totlen = 0;
414  int retc;
415 
416 // Lock the read mutex if we need to, the helper will unlock it upon exit
417 //
418  if (LockReads) theMutex.Lock(&rdMutex);
419 
420 // Wait up to timeout milliseconds for data to arrive
421 //
422  isIdle = 0;
423  while(Blen > 0)
424  {do {retc = poll(&polltab,1,timeout);} while(retc < 0 && errno == EINTR);
425  if (retc != 1)
426  {if (retc == 0)
427  {tardyCnt++;
428  if (totlen)
429  {if ((++stallCnt & 0xff) == 1) TRACEI(DEBUG,"read timed out");
430  AtomicAdd(BytesIn, totlen);
431  }
432  return int(totlen);
433  }
434  return (LinkInfo.FD >= 0 ? Log.Emsg("Link",-errno,"poll",ID) : -1);
435  }
436 
437  // Verify it is safe to read now
438  //
439  if (!(polltab.revents & (POLLIN|POLLRDNORM)))
440  {Log.Emsg("Link", XrdPoll::Poll2Text(polltab.revents),
441  "polling", ID);
442  return -1;
443  }
444 
445  // Read as much data as you can. Note that we will force an error
446  // if we get a zero-length read after poll said it was OK.
447  //
448  do {rlen = recv(LinkInfo.FD, Buff, Blen, 0);}
449  while(rlen < 0 && errno == EINTR);
450  if (rlen <= 0)
451  {if (!rlen) return -ENOMSG;
452  if (LinkInfo.FD > 0) Log.Emsg("Link", -errno, "receive from", ID);
453  return -1;
454  }
455  totlen += rlen; Blen -= rlen; Buff += rlen;
456  }
457 
458  AtomicAdd(BytesIn, totlen);
459  return int(totlen);
460 }

References AtomicAdd, BytesIn, DEBUG, XrdSysError::Emsg(), XrdLinkInfo::FD, XrdPollInfo::FD, XrdLink::ID, isIdle, LinkInfo, XrdSysMutexHelper::Lock(), LockReads, XrdGlobal::Log, XrdPoll::Poll2Text(), PollInfo, rdMutex, stallCnt, tardyCnt, and TRACEI.

+ Here is the call graph for this function:

◆ Recv() [3/3]

int XrdLinkXeq::Recv ( const struct iovec *  iov,
int  iocnt,
int  timeout 
)

Definition at line 464 of file XrdLinkXeq.cc.

465 {
466  XrdSysMutexHelper theMutex;
467  struct pollfd polltab = {PollInfo.FD, POLLIN|POLLRDNORM, 0};
468  int retc, rlen;
469 
470 // Lock the read mutex if we need to, the helper will unlock it upon exit
471 //
472  if (LockReads) theMutex.Lock(&rdMutex);
473 
474 // Wait up to timeout milliseconds for data to arrive
475 //
476  isIdle = 0;
477  do {retc = poll(&polltab,1,timeout);} while(retc < 0 && errno == EINTR);
478  if (retc != 1)
479  {if (retc == 0)
480  {tardyCnt++;
481  return 0;
482  }
483  return (LinkInfo.FD >= 0 ? Log.Emsg("Link",-errno,"poll",ID) : -1);
484  }
485 
486 // Verify it is safe to read now
487 //
488  if (!(polltab.revents & (POLLIN|POLLRDNORM)))
489  {Log.Emsg("Link", XrdPoll::Poll2Text(polltab.revents), "polling", ID);
490  return -1;
491  }
492 
493 // If the iocnt is within limits then just go ahead and read once.
494 //
495  if (iocnt <= maxIOV)
496  {rlen = RecvIOV(iov, iocnt);
497  if (rlen > 0) {AtomicAdd(BytesIn, rlen);}
498  return rlen;
499  }
500 
501 // We will have to break this up into allowable segments and we need to add up
502 // the bytes in each segment so that we know when to stop reading.
503 //
504  int seglen, segcnt = maxIOV, totlen = 0;
505  do {seglen = 0;
506  for (int i = 0; i < segcnt; i++) seglen += iov[i].iov_len;
507  if ((rlen = RecvIOV(iov, segcnt)) < 0) return rlen;
508  totlen += rlen;
509  if (rlen < seglen) break;
510  iov += segcnt;
511  iocnt -= segcnt;
512  if (iocnt <= maxIOV) segcnt = iocnt;
513  } while(iocnt > 0);
514 
515 // All done
516 //
517  AtomicAdd(BytesIn, totlen);
518  return totlen;
519 }
int RecvIOV(const struct iovec *iov, int iocnt)
Definition: XrdLinkXeq.cc:567
int maxIOV
Definition: XrdLinkXeq.cc:98

References AtomicAdd, BytesIn, XrdSysError::Emsg(), XrdLinkInfo::FD, XrdPollInfo::FD, XrdLink::ID, isIdle, LinkInfo, XrdSysMutexHelper::Lock(), LockReads, XrdGlobal::Log, XrdGlobal::maxIOV, XrdPoll::Poll2Text(), PollInfo, rdMutex, RecvIOV(), and tardyCnt.

+ Here is the call graph for this function:

◆ RecvAll()

int XrdLinkXeq::RecvAll ( char *  buff,
int  blen,
int  timeout = -1 
)

Definition at line 525 of file XrdLinkXeq.cc.

526 {
527  struct pollfd polltab = {PollInfo.FD, POLLIN|POLLRDNORM, 0};
528  ssize_t rlen;
529  int retc;
530 
531 // Check if timeout specified. Notice that the timeout is the max we will
532 // for some data. We will wait forever for all the data. Yeah, it's weird.
533 //
534  if (timeout >= 0)
535  {do {retc = poll(&polltab,1,timeout);} while(retc < 0 && errno == EINTR);
536  if (retc != 1)
537  {if (!retc) return -ETIMEDOUT;
538  Log.Emsg("Link",errno,"poll",ID);
539  return -1;
540  }
541  if (!(polltab.revents & (POLLIN|POLLRDNORM)))
542  {Log.Emsg("Link",XrdPoll::Poll2Text(polltab.revents),"polling",ID);
543  return -1;
544  }
545  }
546 
547 // Note that we will block until we receive all he bytes.
548 //
549  if (LockReads) rdMutex.Lock();
550  isIdle = 0;
551  do {rlen = recv(LinkInfo.FD, Buff, Blen, MSG_WAITALL);}
552  while(rlen < 0 && errno == EINTR);
553  if (rlen > 0) AtomicAdd(BytesIn, rlen);
554  if (LockReads) rdMutex.UnLock();
555 
556  if (int(rlen) == Blen) return Blen;
557  if (!rlen) {TRACEI(DEBUG, "No RecvAll() data; errno=" <<errno);}
558  else if (rlen > 0) Log.Emsg("RecvAll", "Premature end from", ID);
559  else if (LinkInfo.FD >= 0) Log.Emsg("Link", errno, "receive from", ID);
560  return -1;
561 }

References AtomicAdd, BytesIn, DEBUG, XrdSysError::Emsg(), XrdLinkInfo::FD, XrdPollInfo::FD, XrdLink::ID, isIdle, LinkInfo, XrdSysMutex::Lock(), LockReads, XrdGlobal::Log, XrdPoll::Poll2Text(), PollInfo, rdMutex, TRACEI, and XrdSysMutex::UnLock().

Referenced by XrdLink::RecvAll().

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

◆ RecvIOV()

int XrdLinkXeq::RecvIOV ( const struct iovec *  iov,
int  iocnt 
)
protected

Definition at line 567 of file XrdLinkXeq.cc.

568 {
569  ssize_t retc = 0;
570 
571 // Read the data in. On some version of Unix (e.g., Linux) a readv() may
572 // end at any time without reading all the bytes when directed to a socket.
573 // We always return the number bytes read (or an error). The caller needs to
574 // restart the read at the appropriate place in the iovec when more data arrives.
575 //
576  do {retc = readv(LinkInfo.FD, iov, iocnt);}
577  while(retc < 0 && errno == EINTR);
578 
579 // Check how we completed
580 //
581  if (retc < 0) Log.Emsg("Link", errno, "receive from", ID);
582  return retc;
583 }
ssize_t readv(int fildes, const struct iovec *iov, int iovcnt)

References XrdSysError::Emsg(), XrdLinkInfo::FD, XrdLink::ID, LinkInfo, XrdGlobal::Log, and readv().

Referenced by Recv().

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

◆ Register()

bool XrdLinkXeq::Register ( const char *  hName)

Definition at line 589 of file XrdLinkXeq.cc.

590 {
591 
592 // Make appropriate changes here
593 //
594  if (HostName) free(HostName);
595  HostName = strdup(hName);
596  strlcpy(Lname, hName, sizeof(Lname));
597  return true;
598 }
size_t strlcpy(char *dst, const char *src, size_t sz)

References XrdLink::HostName, Lname, and strlcpy().

Referenced by XrdLink::Register().

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

◆ Reset()

void XrdLinkXeq::Reset ( )
protected

Definition at line 129 of file XrdLinkXeq.cc.

130 {
131  memcpy(Uname+sizeof(Uname)-7, "anon.0@", 7);
132  strcpy(Lname, "somewhere");
133  ID = &Uname[sizeof(Uname)-5];
134  Comment = ID;
135  sendQ = 0;
136  stallCnt = stallCntTot = 0;
137  tardyCnt = tardyCntTot = 0;
138  SfIntr = 0;
139  isIdle = 0;
141  LockReads= false;
142  KeepFD = false;
143  Protocol = 0;
144  ProtoAlt = 0;
145 
146  LinkInfo.Reset();
147  PollInfo.Zorch();
148  ResetLink();
149 }
const char * Comment
Definition: XrdJob.hh:47
void Reset()
Definition: XrdLinkInfo.hh:52
char Uname[24]
Definition: XrdLinkXeq.hh:200
void Zorch()
Definition: XrdPollInfo.hh:49

References BytesIn, BytesInTot, BytesOut, BytesOutTot, XrdJob::Comment, XrdLink::ID, isIdle, KeepFD, LinkInfo, Lname, LockReads, PollInfo, ProtoAlt, Protocol, XrdLinkInfo::Reset(), XrdLink::ResetLink(), sendQ, SfIntr, stallCnt, stallCntTot, tardyCnt, tardyCntTot, Uname, and XrdPollInfo::Zorch().

Referenced by XrdLinkXeq(), and XrdLinkCtl::Alloc().

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

◆ Send() [1/3]

int XrdLinkXeq::Send ( const char *  buff,
int  blen 
)

Definition at line 604 of file XrdLinkXeq.cc.

605 {
606  ssize_t retc = 0, bytesleft = Blen;
607 
608 // Get a lock
609 //
610  wrMutex.Lock();
611  isIdle = 0;
612  AtomicAdd(BytesOut, Blen);
613 
614 // Do non-blocking writes if we are setup to do so.
615 //
616  if (sendQ)
617  {retc = sendQ->Send(Buff, Blen);
618  wrMutex.UnLock();
619  return retc;
620  }
621 
622 // Write the data out
623 //
624  while(bytesleft)
625  {if ((retc = write(LinkInfo.FD, Buff, bytesleft)) < 0)
626  {if (errno == EINTR) continue;
627  else break;
628  }
629  bytesleft -= retc; Buff += retc;
630  }
631 
632 // All done
633 //
634  wrMutex.UnLock();
635  if (retc >= 0) return Blen;
636  Log.Emsg("Link", errno, "send to", ID);
637  return -1;
638 }
ssize_t write(int fildes, const void *buf, size_t nbyte)
int Send(const char *buff, int blen)
Definition: XrdSendQ.cc:230

References AtomicAdd, BytesOut, XrdSysError::Emsg(), XrdLinkInfo::FD, XrdLink::ID, isIdle, LinkInfo, XrdSysMutex::Lock(), XrdGlobal::Log, XrdSendQ::Send(), sendQ, XrdSysMutex::UnLock(), write(), and wrMutex.

Referenced by XrdLink::Send().

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

◆ Send() [2/3]

int XrdLinkXeq::Send ( const sfVec sdP,
int  sdn 
)

Definition at line 703 of file XrdLinkXeq.cc.

704 {
705 #if !defined(HAVE_SENDFILE)
706 
707  return -1;
708 
709 #elif defined(__solaris__)
710 
711  sendfilevec_t vecSF[XrdOucSFVec::sfMax], *vecSFP = vecSF;
712  size_t xframt, totamt, bytes = 0;
713  ssize_t retc;
714  int i = 0;
715 
716 // Construct the sendfilev() vector
717 //
718  for (i = 0; i < sfN; sfP++, i++)
719  {if (sfP->fdnum < 0)
720  {vecSF[i].sfv_fd = SFV_FD_SELF;
721  vecSF[i].sfv_off = (off_t)sfP->buffer;
722  } else {
723  vecSF[i].sfv_fd = sfP->fdnum;
724  vecSF[i].sfv_off = sfP->offset;
725  }
726  vecSF[i].sfv_flag = 0;
727  vecSF[i].sfv_len = sfP->sendsz;
728  bytes += sfP->sendsz;
729  }
730  totamt = bytes;
731 
732 // Lock the link, issue sendfilev(), and unlock the link. The documentation
733 // is very spotty and inconsistent. We can only retry this operation under
734 // very limited conditions.
735 //
736  wrMutex.Lock();
737  isIdle = 0;
738 do{retc = sendfilev(LinkInfo.FD, vecSFP, sfN, &xframt);
739 
740 // Check if all went well and return if so (usual case)
741 //
742  if (xframt == bytes)
743  {AtomicAdd(BytesOut, bytes);
744  wrMutex.UnLock();
745  return totamt;
746  }
747 
748 // The only one we will recover from is EINTR. We cannot legally get EAGAIN.
749 //
750  if (retc < 0 && errno != EINTR) break;
751 
752 // Try to resume the transfer
753 //
754  if (xframt > 0)
755  {AtomicAdd(BytesOut, xframt); bytes -= xframt; SfIntr++;
756  while(xframt > 0 && sfN)
757  {if ((ssize_t)xframt < (ssize_t)vecSFP->sfv_len)
758  {vecSFP->sfv_off += xframt; vecSFP->sfv_len -= xframt; break;}
759  xframt -= vecSFP->sfv_len; vecSFP++; sfN--;
760  }
761  }
762  } while(sfN > 0);
763 
764 // See if we can recover without destroying the connection
765 //
766  retc = (retc < 0 ? errno : ECANCELED);
767  wrMutex.UnLock();
768  Log.Emsg("Link", retc, "send file to", ID);
769  return -1;
770 
771 #elif defined(__linux__) || defined(__GNU__)
772 
773  static const int setON = 1, setOFF = 0;
774  ssize_t retc = 0, bytesleft;
775  off_t myOffset;
776  int i, xfrbytes = 0, uncork = 1, xIntr = 0;
777 
778 // lock the link
779 //
780  wrMutex.Lock();
781  isIdle = 0;
782 
783 // In linux we need to cork the socket. On permanent errors we do not uncork
784 // the socket because it will be closed in short order.
785 //
786  if (setsockopt(PollInfo.FD, SOL_TCP, TCP_CORK, &setON, sizeof(setON)) < 0)
787  {Log.Emsg("Link", errno, "cork socket for", ID);
788  uncork = 0; sfOK = 0;
789  }
790 
791 // Send the header first
792 //
793  for (i = 0; i < sfN; sfP++, i++)
794  {if (sfP->fdnum < 0) retc = sendData(sfP->buffer, sfP->sendsz);
795  else {myOffset = sfP->offset; bytesleft = sfP->sendsz;
796  while(bytesleft
797  && (retc=sendfile(LinkInfo.FD,sfP->fdnum,&myOffset,bytesleft)) > 0)
798  {bytesleft -= retc; xIntr++;}
799  }
800  if (retc < 0 && errno == EINTR) continue;
801  if (retc <= 0) break;
802  xfrbytes += sfP->sendsz;
803  }
804 
805 // Diagnose any sendfile errors
806 //
807  if (retc <= 0)
808  {if (retc == 0) errno = ECANCELED;
809  wrMutex.UnLock();
810  Log.Emsg("Link", errno, "send file to", ID);
811  return -1;
812  }
813 
814 // Now uncork the socket
815 //
816  if (uncork
817  && setsockopt(PollInfo.FD, SOL_TCP, TCP_CORK, &setOFF, sizeof(setOFF)) < 0)
818  Log.Emsg("Link", errno, "uncork socket for", ID);
819 
820 // All done
821 //
822  if (xIntr > sfN) SfIntr += (xIntr - sfN);
823  AtomicAdd(BytesOut, xfrbytes);
824  wrMutex.UnLock();
825  return xfrbytes;
826 
827 #else
828 
829  return -1;
830 
831 #endif
832 }
int sendData(const char *Buff, int Blen)
Definition: XrdLinkXeq.cc:838

References AtomicAdd, BytesOut, XrdSysError::Emsg(), XrdLinkInfo::FD, XrdPollInfo::FD, XrdOucSFVec::fdnum, XrdLink::ID, isIdle, LinkInfo, XrdSysMutex::Lock(), XrdGlobal::Log, PollInfo, sendData(), XrdOucSFVec::sendsz, SfIntr, XrdOucSFVec::sfMax, XrdLink::sfOK, XrdSysMutex::UnLock(), and wrMutex.

+ Here is the call graph for this function:

◆ Send() [3/3]

int XrdLinkXeq::Send ( const struct iovec *  iov,
int  iocnt,
int  bytes = 0 
)

Definition at line 642 of file XrdLinkXeq.cc.

643 {
644  int retc;
645  static int maxIOV = -1;
646  if (maxIOV == -1) {
647 #ifdef _SC_IOV_MAX
648  maxIOV = sysconf(_SC_IOV_MAX);
649  if (maxIOV == -1)
650 #endif
651 #ifdef IOV_MAX
652  maxIOV = IOV_MAX;
653 #else
654  maxIOV = 1024;
655 #endif
656  }
657 
658 // Get a lock and assume we will be successful (statistically we are)
659 //
660  wrMutex.Lock();
661  isIdle = 0;
662  AtomicAdd(BytesOut, bytes);
663 
664 // Do non-blocking writes if we are setup to do so.
665 //
666  if (sendQ)
667  {retc = sendQ->Send(iov, iocnt, bytes);
668  wrMutex.UnLock();
669  return retc;
670  }
671 
672 // If the iocnt is within limits then just go ahead and write this out
673 //
674  if (iocnt <= maxIOV)
675  {retc = SendIOV(iov, iocnt, bytes);
676  wrMutex.UnLock();
677  return retc;
678  }
679 
680 // We will have to break this up into allowable segments
681 //
682  int seglen, segcnt = maxIOV, iolen = 0;
683  do {seglen = 0;
684  for (int i = 0; i < segcnt; i++) seglen += iov[i].iov_len;
685  if ((retc = SendIOV(iov, segcnt, seglen)) < 0)
686  {wrMutex.UnLock();
687  return retc;
688  }
689  iolen += retc;
690  iov += segcnt;
691  iocnt -= segcnt;
692  if (iocnt <= maxIOV) segcnt = iocnt;
693  } while(iocnt > 0);
694 
695 // All done
696 //
697  wrMutex.UnLock();
698  return iolen;
699 }
int SendIOV(const struct iovec *iov, int iocnt, int bytes)
Definition: XrdLinkXeq.cc:861

References AtomicAdd, BytesOut, isIdle, XrdSysMutex::Lock(), XrdGlobal::maxIOV, XrdSendQ::Send(), SendIOV(), sendQ, XrdSysMutex::UnLock(), and wrMutex.

+ Here is the call graph for this function:

◆ sendData()

int XrdLinkXeq::sendData ( const char *  Buff,
int  Blen 
)
protected

Definition at line 838 of file XrdLinkXeq.cc.

839 {
840  ssize_t retc = 0, bytesleft = Blen;
841 
842 // Write the data out
843 //
844  while(bytesleft)
845  {if ((retc = write(LinkInfo.FD, Buff, bytesleft)) < 0)
846  {if (errno == EINTR) continue;
847  else break;
848  }
849  bytesleft -= retc; Buff += retc;
850  }
851 
852 // All done
853 //
854  return retc;
855 }

References XrdLinkInfo::FD, LinkInfo, and write().

Referenced by Send().

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

◆ SendIOV()

int XrdLinkXeq::SendIOV ( const struct iovec *  iov,
int  iocnt,
int  bytes 
)
protected

Definition at line 861 of file XrdLinkXeq.cc.

862 {
863  ssize_t bytesleft, n, retc = 0;
864  const char *Buff;
865 
866 // Write the data out. On some version of Unix (e.g., Linux) a writev() may
867 // end at any time without writing all the bytes when directed to a socket.
868 // So, we attempt to resume the writev() using a combination of write() and
869 // a writev() continuation. This approach slowly converts a writev() to a
870 // series of writes if need be. We must do this inline because we must hold
871 // the lock until all the bytes are written or an error occurs.
872 //
873  bytesleft = static_cast<ssize_t>(bytes);
874  while(bytesleft)
875  {do {retc = writev(LinkInfo.FD, iov, iocnt);}
876  while(retc < 0 && errno == EINTR);
877  if (retc >= bytesleft || retc < 0) break;
878  bytesleft -= retc;
879  while(retc >= (n = static_cast<ssize_t>(iov->iov_len)))
880  {retc -= n; iov++; iocnt--;}
881  Buff = (const char *)iov->iov_base + retc; n -= retc; iov++; iocnt--;
882  while(n) {if ((retc = write(LinkInfo.FD, Buff, n)) < 0)
883  {if (errno == EINTR) continue;
884  else break;
885  }
886  n -= retc; Buff += retc; bytesleft -= retc;
887  }
888  if (retc < 0 || iocnt < 1) break;
889  }
890 
891 // All done
892 //
893  if (retc >= 0) return bytes;
894  Log.Emsg("Link", errno, "send to", ID);
895  return -1;
896 }
ssize_t writev(int fildes, const struct iovec *iov, int iovcnt)

References XrdSysError::Emsg(), XrdLinkInfo::FD, XrdLink::ID, LinkInfo, XrdGlobal::Log, write(), and writev().

Referenced by Send().

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

◆ setID()

void XrdLinkXeq::setID ( const char *  userid,
int  procid 
)

Definition at line 902 of file XrdLinkXeq.cc.

903 {
904  char buff[sizeof(Uname)], *bp, *sp;
905  int ulen;
906 
907  snprintf(buff, sizeof(buff), "%s.%d:%d", userid, procid, PollInfo.FD);
908  ulen = strlen(buff);
909  sp = buff + ulen - 1;
910  bp = &Uname[sizeof(Uname)-1];
911  if (ulen > (int)sizeof(Uname)) ulen = sizeof(Uname);
912  *bp = '@'; bp--;
913  while(ulen--) {*bp = *sp; bp--; sp--;}
914  ID = bp+1;
915  Comment = (const char *)ID;
916 
917 // Update the ID in the TLS socket if enabled
918 //
919  if (isTLS) tlsIO.SetTraceID(ID);
920 }
void SetTraceID(const char *tid)

References XrdJob::Comment, XrdPollInfo::FD, XrdLink::ID, XrdLink::isTLS, PollInfo, XrdTlsSocket::SetTraceID(), tlsIO, and Uname.

Referenced by XrdLink::setID().

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

◆ setLocation()

void XrdLinkXeq::setLocation ( XrdNetAddrInfo::LocInfo loc)
inline

Definition at line 107 of file XrdLinkXeq.hh.

107 {Addr.SetLocation(loc);}
void SetLocation(XrdNetAddrInfo::LocInfo &loc)
Definition: XrdNetAddr.cc:571

References Addr, and XrdNetAddr::SetLocation().

Referenced by XrdLink::setLocation().

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

◆ setNB()

bool XrdLinkXeq::setNB ( )

Definition at line 926 of file XrdLinkXeq.cc.

927 {
928 // We don't support non-blocking output except for Linux at the moment
929 //
930 #if !defined(__linux__)
931  return false;
932 #else
933 // Trace this request
934 //
935  TRACEI(DEBUG,"enabling non-blocking output");
936 
937 // If we don't already have a sendQ object get one. This is a one-time call
938 // so to optimize checking if this object exists we also get the opMutex.'
939 //
941  if (!sendQ)
942  {wrMutex.Lock();
943  sendQ = new XrdSendQ(*this, wrMutex);
944  wrMutex.UnLock();
945  }
947  return true;
948 #endif
949 }

References DEBUG, LinkInfo, XrdSysMutex::Lock(), XrdLinkInfo::opMutex, sendQ, TRACEI, XrdSysMutex::UnLock(), and wrMutex.

Referenced by XrdLink::setNB().

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

◆ setProtName()

void XrdLinkXeq::setProtName ( const char *  name)

Definition at line 972 of file XrdLinkXeq.cc.

973 {
974 
975 // Set the protocol name.
976 //
978  Addr.SetDialect(name);
980 }
void SetDialect(const char *dP)
Definition: XrdNetAddr.hh:205

References Addr, LinkInfo, XrdSysMutex::Lock(), XrdLinkInfo::opMutex, XrdNetAddr::SetDialect(), and XrdSysMutex::UnLock().

Referenced by XrdLink::setProtName().

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

◆ setProtocol()

XrdProtocol * XrdLinkXeq::setProtocol ( XrdProtocol pp,
bool  push 
)

Definition at line 955 of file XrdLinkXeq.cc.

956 {
957 
958 // Set new protocol.
959 //
961  XrdProtocol *op = Protocol;
962  if (push) ProtoAlt = Protocol;
963  Protocol = pp;
965  return op;
966 }

References LinkInfo, XrdSysMutex::Lock(), XrdLinkInfo::opMutex, ProtoAlt, Protocol, and XrdSysMutex::UnLock().

Referenced by XrdLink::setProtocol().

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

◆ setTLS()

bool XrdLinkXeq::setTLS ( bool  enable,
XrdTlsContext ctx = 0 
)

Definition at line 986 of file XrdLinkXeq.cc.

987 { //???
988 // static const XrdTlsConnection::RW_Mode rwMode=XrdTlsConnection::TLS_RNB_WBL;
991  const char *eNote;
992  XrdTls::RC rc;
993 
994 // If we are already in a compatible mode, we are done
995 //
996 
997  if (isTLS == enable) return true;
998 
999 // If this is a shutdown, then do it now.
1000 //
1001  if (!enable)
1002  {tlsIO.Shutdown();
1003  isTLS = enable;
1004  Addr.SetTLS(enable);
1005  return true;
1006  }
1007 // We want to initialize TLS, do so now.
1008 //
1009  if (!ctx) ctx = tlsCtx;
1010  eNote = tlsIO.Init(*ctx, PollInfo.FD, rwMode, hsMode, false, false, ID);
1011 
1012 // Check for errors
1013 //
1014  if (eNote)
1015  {char buff[1024];
1016  snprintf(buff, sizeof(buff), "Unable to enable tls for %s;", ID);
1017  Log.Emsg("LinkXeq", buff, eNote);
1018  return false;
1019  }
1020 
1021 // Now we need to accept this TLS connection
1022 //
1023  std::string eMsg;
1024  rc = tlsIO.Accept(&eMsg);
1025 
1026 // Diagnose return state
1027 //
1028  if (rc != XrdTls::TLS_AOK) Log.Emsg("LinkXeq", eMsg.c_str());
1029  else {isTLS = enable;
1030  Addr.SetTLS(enable);
1031  Log.Emsg("LinkXeq", ID, "connection upgraded to", verTLS());
1032  }
1033  return rc == XrdTls::TLS_AOK;
1034 }
#define eMsg(x)
const char * verTLS()
Definition: XrdLinkXeq.cc:1474
void SetTLS(bool val)
Definition: XrdNetAddr.cc:582
@ TLS_HS_BLOCK
Always block during handshake.
Definition: XrdTlsSocket.hh:53
XrdTls::RC Accept(std::string *eMsg=0)
@ TLS_RBL_WBL
blocking read blocking write
Definition: XrdTlsSocket.hh:48
const char * Init(XrdTlsContext &ctx, int sfd, RW_Mode rwm, HS_Mode hsm, bool isClient, bool serial=true, const char *tid="")
@ TLS_AOK
All went well, will always be zero.
Definition: XrdTls.hh:40
XrdTlsContext * tlsCtx
Definition: XrdGlobals.cc:52

References XrdTlsSocket::Accept(), Addr, XrdSysError::Emsg(), eMsg, XrdPollInfo::FD, XrdLink::ID, XrdTlsSocket::Init(), XrdLink::isTLS, XrdGlobal::Log, PollInfo, XrdNetAddr::SetTLS(), XrdTlsSocket::Shutdown(), XrdTls::TLS_AOK, XrdTlsSocket::TLS_HS_BLOCK, XrdTlsSocket::TLS_RBL_WBL, XrdGlobal::tlsCtx, tlsIO, and verTLS().

Referenced by XrdLink::setTLS().

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

◆ SFError()

int XrdLinkXeq::SFError ( int  rc)
protected

Definition at line 1040 of file XrdLinkXeq.cc.

1041 {
1042  Log.Emsg("TLS", rc, "send file to", ID);
1043  return -1;
1044 }

References XrdSysError::Emsg(), XrdLink::ID, and XrdGlobal::Log.

Referenced by TLS_Send().

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

◆ Shutdown()

void XrdLinkXeq::Shutdown ( bool  getLock)

Definition at line 1050 of file XrdLinkXeq.cc.

1051 {
1052  int temp;
1053 
1054 // Trace the entry
1055 //
1056  TRACEI(DEBUG, (getLock ? "Async" : "Sync") <<" link shutdown in progress");
1057 
1058 // Get the lock if we need too (external entry via another thread)
1059 //
1060  if (getLock) LinkInfo.opMutex.Lock();
1061 
1062 // If there is something to do, do it now
1063 //
1064  temp = Instance; Instance = 0;
1065  if (!KeepFD)
1066  {shutdown(PollInfo.FD, SHUT_RDWR);
1067  if (dup2(devNull, PollInfo.FD) < 0)
1068  {Instance = temp;
1069  Log.Emsg("Link", errno, "shutdown FD for", ID);
1070  }
1071  }
1072 
1073 // All done
1074 //
1075  if (getLock) LinkInfo.opMutex.UnLock();
1076 }
int devNull
Definition: XrdGlobals.cc:55

References DEBUG, XrdGlobal::devNull, XrdSysError::Emsg(), XrdPollInfo::FD, XrdLink::ID, XrdLink::Instance, KeepFD, LinkInfo, XrdSysMutex::Lock(), XrdGlobal::Log, XrdLinkInfo::opMutex, PollInfo, TRACEI, and XrdSysMutex::UnLock().

Referenced by Close(), and XrdLink::Shutdown().

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

◆ Stats()

int XrdLinkXeq::Stats ( char *  buff,
int  blen,
bool  do_sync = false 
)
static

Definition at line 1082 of file XrdLinkXeq.cc.

1083 {
1084  static const char statfmt[] = "<stats id=\"link\"><num>%d</num>"
1085  "<maxn>%d</maxn><tot>%lld</tot><in>%lld</in><out>%lld</out>"
1086  "<ctime>%lld</ctime><tmo>%d</tmo><stall>%d</stall>"
1087  "<sfps>%d</sfps></stats>";
1088  int i;
1089 
1090 // Check if actual length wanted
1091 //
1092  if (!buff) return sizeof(statfmt)+17*6;
1093 
1094 // We must synchronize the statistical counters
1095 //
1096  if (do_sync) XrdLinkCtl::SyncAll();
1097 
1098 // Obtain lock on the stats area and format it
1099 //
1101  i = snprintf(buff, blen, statfmt, AtomicGet(LinkCount),
1111  return i;
1112 }
#define AtomicBeg(Mtx)
#define AtomicGet(x)
#define AtomicEnd(Mtx)
static void SyncAll()
Synchronize statustics for ll links.
Definition: XrdLinkCtl.cc:374
static int LinkCountMax
Definition: XrdLinkXeq.hh:166
static long long LinkCountTot
Definition: XrdLinkXeq.hh:164
static int LinkCount
Definition: XrdLinkXeq.hh:165
static long long LinkBytesIn
Definition: XrdLinkXeq.hh:161
static long long LinkConTime
Definition: XrdLinkXeq.hh:163
static int LinkSfIntr
Definition: XrdLinkXeq.hh:169
static XrdSysMutex statsMutex
Definition: XrdLinkXeq.hh:179
static int LinkStalls
Definition: XrdLinkXeq.hh:168
static long long LinkBytesOut
Definition: XrdLinkXeq.hh:162
static int LinkTimeOuts
Definition: XrdLinkXeq.hh:167

References AtomicBeg, AtomicEnd, AtomicGet, LinkBytesIn, LinkBytesOut, LinkConTime, LinkCount, LinkCountMax, LinkCountTot, LinkSfIntr, LinkStalls, LinkTimeOuts, statsMutex, and XrdLinkCtl::SyncAll().

Referenced by XrdLink::Stats().

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

◆ syncStats()

void XrdLinkXeq::syncStats ( int *  ctime = 0)

Definition at line 1118 of file XrdLinkXeq.cc.

1119 {
1120  long long tmpLL;
1121  int tmpI4;
1122 
1123 // If this is dynamic, get the opMutex lock
1124 //
1125  if (!ctime) LinkInfo.opMutex.Lock();
1126 
1127 // Either the caller has the opMutex or this is called out of close. In either
1128 // case, we need to get the read and write mutexes; each followed by the stats
1129 // mutex. This order is important because we should not hold the stats mutex
1130 // for very long and the r/w mutexes may take a long time to acquire. If we
1131 // must maintain the link count we need to actually acquire the stats mutex as
1132 // we will be doing compound operations. Atomics are still used to keep other
1133 // threads from seeing partial results.
1134 //
1135  AtomicBeg(rdMutex);
1136 
1137  if (ctime)
1138  {*ctime = time(0) - LinkInfo.conTime;
1139  AtomicAdd(LinkConTime, *ctime);
1140  statsMutex.Lock();
1141  if (LinkCount > 0) AtomicDec(LinkCount);
1142  statsMutex.UnLock();
1143  }
1144 
1146 
1147  tmpLL = AtomicFAZ(BytesIn);
1148  AtomicAdd(LinkBytesIn, tmpLL); AtomicAdd(BytesInTot, tmpLL);
1149  tmpI4 = AtomicFAZ(tardyCnt);
1150  AtomicAdd(LinkTimeOuts, tmpI4); AtomicAdd(tardyCntTot, tmpI4);
1151  tmpI4 = AtomicFAZ(stallCnt);
1152  AtomicAdd(LinkStalls, tmpI4); AtomicAdd(stallCntTot, tmpI4);
1154 
1156  tmpLL = AtomicFAZ(BytesOut);
1157  AtomicAdd(LinkBytesOut, tmpLL); AtomicAdd(BytesOutTot, tmpLL);
1158  tmpI4 = AtomicFAZ(SfIntr);
1159  AtomicAdd(LinkSfIntr, tmpI4);
1161 
1162 // Make sure the protocol updates it's statistics as well
1163 //
1164  if (Protocol) Protocol->Stats(0, 0, 1);
1165 
1166 // All done
1167 //
1168  if (!ctime) LinkInfo.opMutex.UnLock();
1169 }
#define AtomicFAZ(x)
#define AtomicDec(x)
time_t conTime
Definition: XrdLinkInfo.hh:44
virtual int Stats(char *buff, int blen, int do_sync=0)=0

References AtomicAdd, AtomicBeg, AtomicDec, AtomicEnd, AtomicFAZ, BytesIn, BytesInTot, BytesOut, BytesOutTot, XrdLinkInfo::conTime, LinkBytesIn, LinkBytesOut, LinkConTime, LinkCount, LinkInfo, LinkSfIntr, LinkStalls, LinkTimeOuts, XrdSysMutex::Lock(), XrdLinkInfo::opMutex, Protocol, rdMutex, SfIntr, stallCnt, stallCntTot, XrdProtocol::Stats(), statsMutex, tardyCnt, tardyCntTot, XrdSysMutex::UnLock(), and wrMutex.

Referenced by Close(), and XrdLink::syncStats().

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

◆ TLS_Error()

int XrdLinkXeq::TLS_Error ( const char *  act,
XrdTls::RC  rc 
)
protected

Definition at line 1175 of file XrdLinkXeq.cc.

1176 {
1177  std::string reason = XrdTls::RC2Text(rc);
1178  char msg[512];
1179 
1180  snprintf(msg, sizeof(msg), "Unable to %s %s;", act, ID);
1181  Log.Emsg("TLS", msg, reason.c_str());
1182  return -1;
1183 }
static std::string RC2Text(XrdTls::RC rc, bool dbg=false)
Definition: XrdTls.cc:127

References XrdSysError::Emsg(), XrdLink::ID, XrdGlobal::Log, and XrdTls::RC2Text().

Referenced by TLS_Peek(), TLS_Recv(), TLS_Send(), and TLS_Write().

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

◆ TLS_Peek()

int XrdLinkXeq::TLS_Peek ( char *  Buff,
int  Blen,
int  timeout 
)

Definition at line 1189 of file XrdLinkXeq.cc.

1190 {
1191  XrdSysMutexHelper theMutex;
1192  XrdTls::RC retc;
1193  int rc, rlen;
1194 
1195 // Lock the read mutex if we need to, the helper will unlock it upon exit
1196 //
1197  if (LockReads) theMutex.Lock(&rdMutex);
1198 
1199 // Wait until we can actually read something
1200 //
1201  isIdle = 0;
1202  if (timeout)
1203  {rc = Wait4Data(timeout);
1204  if (rc < 1) return rc;
1205  }
1206 
1207 // Do the peek and if sucessful, the number of bytes available.
1208 //
1209  retc = tlsIO.Peek(Buff, Blen, rlen);
1210  if (retc == XrdTls::TLS_AOK) return rlen;
1211 
1212 // Dianose the TLS error and return failure
1213 //
1214  return TLS_Error("peek on", retc);
1215 }
int TLS_Error(const char *act, XrdTls::RC rc)
Definition: XrdLinkXeq.cc:1175
XrdTls::RC Peek(char *buffer, size_t size, int &bytesPeek)

References isIdle, XrdSysMutexHelper::Lock(), LockReads, XrdTlsSocket::Peek(), rdMutex, XrdTls::TLS_AOK, TLS_Error(), tlsIO, and XrdLink::Wait4Data().

Referenced by XrdLink::Peek().

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

◆ TLS_Recv() [1/3]

int XrdLinkXeq::TLS_Recv ( char *  Buff,
int  Blen 
)

Definition at line 1221 of file XrdLinkXeq.cc.

1222 {
1223  XrdSysMutexHelper theMutex;
1224  XrdTls::RC retc;
1225  int rlen;
1226 
1227 // Lock the read mutex if we need to, the helper will unlock it upon exit
1228 //
1229  if (LockReads) theMutex.Lock(&rdMutex);
1230 
1231 // Note that we will read only as much as is queued. Use Recv() with a
1232 // timeout to receive as much data as possible.
1233 //
1234  isIdle = 0;
1235  retc = tlsIO.Read(Buff, Blen, rlen);
1236  if (retc != XrdTls::TLS_AOK) return TLS_Error("receive from", retc);
1237  if (rlen > 0) AtomicAdd(BytesIn, rlen);
1238  return rlen;
1239 }
XrdTls::RC Read(char *buffer, size_t size, int &bytesRead)
Read from the TLS connection. If necessary, a handshake will be done.

References AtomicAdd, BytesIn, isIdle, XrdSysMutexHelper::Lock(), LockReads, rdMutex, XrdTlsSocket::Read(), XrdTls::TLS_AOK, TLS_Error(), and tlsIO.

Referenced by XrdLink::Recv(), TLS_Recv(), and TLS_RecvAll().

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

◆ TLS_Recv() [2/3]

int XrdLinkXeq::TLS_Recv ( char *  Buff,
int  Blen,
int  timeout,
bool  havelock = false 
)

Definition at line 1243 of file XrdLinkXeq.cc.

1244 {
1245  XrdSysMutexHelper theMutex;
1246  XrdTls::RC retc;
1247  int pend, rlen, totlen = 0;
1248 
1249 // Lock the read mutex if we need to, the helper will unlock it upon exit
1250 //
1251  if (LockReads && !havelock) theMutex.Lock(&rdMutex);
1252 
1253 // Wait up to timeout milliseconds for data to arrive
1254 //
1255  isIdle = 0;
1256  while(Blen > 0)
1257  {pend = tlsIO.Pending(true);
1258  if (!pend) pend = Wait4Data(timeout);
1259  if (pend < 1)
1260  {if (pend < 0) return -1;
1261  tardyCnt++;
1262  if (totlen)
1263  {if ((++stallCnt & 0xff) == 1) TRACEI(DEBUG,"read timed out");
1264  AtomicAdd(BytesIn, totlen);
1265  }
1266  return totlen;
1267  }
1268 
1269  // Read as much data as you can. Note that we will force an error
1270  // if we get a zero-length read after poll said it was OK. However,
1271  // if we never read anything, then we simply return -ENOMSG to avoid
1272  // generating a "read link error" as clearly there was a hangup.
1273  //
1274  retc = tlsIO.Read(Buff, Blen, rlen);
1275  if (retc != XrdTls::TLS_AOK)
1276  {if (!totlen) return -ENOMSG;
1277  AtomicAdd(BytesIn, totlen);
1278  return TLS_Error("receive from", retc);
1279  }
1280  if (rlen <= 0) break;
1281  totlen += rlen; Blen -= rlen; Buff += rlen;
1282  }
1283 
1284  AtomicAdd(BytesIn, totlen);
1285  return totlen;
1286 }
int Pending(bool any=true)

References AtomicAdd, BytesIn, DEBUG, isIdle, XrdSysMutexHelper::Lock(), LockReads, XrdTlsSocket::Pending(), rdMutex, XrdTlsSocket::Read(), stallCnt, tardyCnt, XrdTls::TLS_AOK, TLS_Error(), tlsIO, TRACEI, and XrdLink::Wait4Data().

+ Here is the call graph for this function:

◆ TLS_Recv() [3/3]

int XrdLinkXeq::TLS_Recv ( const struct iovec *  iov,
int  iocnt,
int  timeout 
)

Definition at line 1290 of file XrdLinkXeq.cc.

1291 {
1292  XrdSysMutexHelper theMutex;
1293  char *Buff;
1294  int Blen, rlen, totlen = 0;
1295 
1296 // Lock the read mutex if we need to, the helper will unlock it upon exit
1297 //
1298  if (LockReads) theMutex.Lock(&rdMutex);
1299 
1300 // Individually process each element until we can't read any more
1301 //
1302  isIdle = 0;
1303  for (int i = 0; i < iocnt; i++)
1304  {Buff = (char *)iov[i].iov_base;
1305  Blen = iov[i].iov_len;
1306  rlen = TLS_Recv(Buff, Blen, timeout, true);
1307  if (rlen <= 0) break;
1308  totlen += rlen;
1309  if (rlen < Blen) break;
1310  }
1311 
1312  if (totlen) {AtomicAdd(BytesIn, totlen);}
1313  return totlen;
1314 }
int TLS_Recv(char *Buff, int Blen)
Definition: XrdLinkXeq.cc:1221

References AtomicAdd, BytesIn, isIdle, XrdSysMutexHelper::Lock(), LockReads, rdMutex, and TLS_Recv().

+ Here is the call graph for this function:

◆ TLS_RecvAll()

int XrdLinkXeq::TLS_RecvAll ( char *  Buff,
int  Blen,
int  timeout 
)

Definition at line 1320 of file XrdLinkXeq.cc.

1321 {
1322  int retc;
1323 
1324 // Check if timeout specified. Notice that the timeout is the max we will
1325 // wait for some data. We will wait forever for all the data. Yeah, it's weird.
1326 //
1327  if (timeout >= 0)
1328  {retc = tlsIO.Pending(true);
1329  if (!retc) retc = Wait4Data(timeout);
1330  if (retc < 1) return (retc ? -1 : -ETIMEDOUT);
1331  }
1332 
1333 // Note that we will block until we receive all the bytes.
1334 //
1335  return TLS_Recv(Buff, Blen, -1);
1336 }

References XrdTlsSocket::Pending(), TLS_Recv(), tlsIO, and XrdLink::Wait4Data().

Referenced by XrdLink::RecvAll().

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

◆ TLS_Send() [1/3]

int XrdLinkXeq::TLS_Send ( const char *  Buff,
int  Blen 
)

Definition at line 1342 of file XrdLinkXeq.cc.

1343 {
1345  ssize_t bytesleft = Blen;
1346  XrdTls::RC retc;
1347  int byteswritten;
1348 
1349 // Prepare to send
1350 //
1351  isIdle = 0;
1352  AtomicAdd(BytesOut, Blen);
1353 
1354 // Do non-blocking writes if we are setup to do so.
1355 //
1356  if (sendQ) return sendQ->Send(Buff, Blen);
1357 
1358 // Write the data out
1359 //
1360  while(bytesleft)
1361  {retc = tlsIO.Write(Buff, bytesleft, byteswritten);
1362  if (retc != XrdTls::TLS_AOK) return TLS_Error("send to", retc);
1363  bytesleft -= byteswritten; Buff += byteswritten;
1364  }
1365 
1366 // All done
1367 //
1368  return Blen;
1369 }
XrdTls::RC Write(const char *buffer, size_t size, int &bytesOut)

References AtomicAdd, BytesOut, isIdle, XrdSendQ::Send(), sendQ, XrdTls::TLS_AOK, TLS_Error(), tlsIO, XrdTlsSocket::Write(), and wrMutex.

Referenced by XrdLink::Send().

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

◆ TLS_Send() [2/3]

int XrdLinkXeq::TLS_Send ( const sfVec sfP,
int  sfN 
)

Definition at line 1408 of file XrdLinkXeq.cc.

1409 {
1411  int bytes, buffsz, fileFD, retc;
1412  off_t offset;
1413  ssize_t totamt = 0;
1414  char myBuff[65536];
1415 
1416 // Convert the sendfile to a regular send. The conversion is not particularly
1417 // fast and caller are advised to avoid using sendfile on TLS connections.
1418 //
1419  isIdle = 0;
1420  for (int i = 0; i < sfN; sfP++, i++)
1421  {if (!(bytes = sfP->sendsz)) continue;
1422  totamt += bytes;
1423  if (sfP->fdnum < 0)
1424  {if (!TLS_Write(sfP->buffer, bytes)) return -1;
1425  continue;
1426  }
1427  offset = sfP->offset;
1428  fileFD = sfP->fdnum;
1429  buffsz = (bytes < (int)sizeof(myBuff) ? bytes : sizeof(myBuff));
1430  do {do {retc = pread(fileFD, myBuff, buffsz, offset);}
1431  while(retc < 0 && errno == EINTR);
1432  if (retc < 0) return SFError(errno);
1433  if (!retc) break;
1434  if (!TLS_Write(myBuff, buffsz)) return -1;
1435  offset += buffsz; bytes -= buffsz; totamt += retc;
1436  } while(bytes > 0);
1437  }
1438 
1439 // We are done
1440 //
1441  AtomicAdd(BytesOut, totamt);
1442  return totamt;
1443 }
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset)
bool TLS_Write(const char *Buff, int Blen)
Definition: XrdLinkXeq.cc:1449
int SFError(int rc)
Definition: XrdLinkXeq.cc:1040

References AtomicAdd, BytesOut, XrdOucSFVec::fdnum, isIdle, pread(), XrdOucSFVec::sendsz, SFError(), TLS_Write(), and wrMutex.

+ Here is the call graph for this function:

◆ TLS_Send() [3/3]

int XrdLinkXeq::TLS_Send ( const struct iovec *  iov,
int  iocnt,
int  bytes 
)

Definition at line 1373 of file XrdLinkXeq.cc.

1374 {
1376  XrdTls::RC retc;
1377  int byteswritten;
1378 
1379 // Get a lock and assume we will be successful (statistically we are). Note
1380 // that the calling interface gauranteed bytes are not zero.
1381 //
1382  isIdle = 0;
1383  AtomicAdd(BytesOut, bytes);
1384 
1385 // Do non-blocking writes if we are setup to do so.
1386 //
1387  if (sendQ) return sendQ->Send(iov, iocnt, bytes);
1388 
1389 // Write the data out.
1390 //
1391  for (int i = 0; i < iocnt; i++)
1392  {ssize_t bytesleft = iov[i].iov_len;
1393  char *Buff = (char *)iov[i].iov_base;
1394  while(bytesleft)
1395  {retc = tlsIO.Write(Buff, bytesleft, byteswritten);
1396  if (retc != XrdTls::TLS_AOK) return TLS_Error("send to", retc);
1397  bytesleft -= byteswritten; Buff += byteswritten;
1398  }
1399  }
1400 
1401 // All done
1402 //
1403  return bytes;
1404 }

References AtomicAdd, BytesOut, isIdle, XrdSendQ::Send(), sendQ, XrdTls::TLS_AOK, TLS_Error(), tlsIO, XrdTlsSocket::Write(), and wrMutex.

+ Here is the call graph for this function:

◆ TLS_Write()

bool XrdLinkXeq::TLS_Write ( const char *  Buff,
int  Blen 
)
protected

Definition at line 1449 of file XrdLinkXeq.cc.

1450 {
1451  XrdTls::RC retc;
1452  int byteswritten;
1453 
1454 // Write the data out
1455 //
1456  while(Blen)
1457  {retc = tlsIO.Write(Buff, Blen, byteswritten);
1458  if (retc != XrdTls::TLS_AOK)
1459  {TLS_Error("write to", retc);
1460  return false;
1461  }
1462  Blen -= byteswritten; Buff += byteswritten;
1463  }
1464 
1465 // All done
1466 //
1467  return true;
1468 }

References XrdTls::TLS_AOK, TLS_Error(), tlsIO, and XrdTlsSocket::Write().

Referenced by TLS_Send().

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

◆ verTLS()

const char * XrdLinkXeq::verTLS ( )

Definition at line 1474 of file XrdLinkXeq.cc.

1475 {
1476  return tlsIO.Version();
1477 }
const char * Version()

References tlsIO, and XrdTlsSocket::Version().

Referenced by setTLS(), and XrdLink::verTLS().

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

Member Data Documentation

◆ Addr

XrdNetAddr XrdLinkXeq::Addr
protected

◆ BytesIn

long long XrdLinkXeq::BytesIn
protected

Definition at line 170 of file XrdLinkXeq.hh.

Referenced by getIOStats(), Recv(), RecvAll(), Reset(), syncStats(), and TLS_Recv().

◆ BytesInTot

long long XrdLinkXeq::BytesInTot
protected

Definition at line 171 of file XrdLinkXeq.hh.

Referenced by Close(), getIOStats(), Reset(), and syncStats().

◆ BytesOut

long long XrdLinkXeq::BytesOut
protected

Definition at line 172 of file XrdLinkXeq.hh.

Referenced by getIOStats(), Reset(), Send(), syncStats(), and TLS_Send().

◆ BytesOutTot

long long XrdLinkXeq::BytesOutTot
protected

Definition at line 173 of file XrdLinkXeq.hh.

Referenced by Close(), getIOStats(), Reset(), and syncStats().

◆ HNlen

int XrdLinkXeq::HNlen
protected

Definition at line 196 of file XrdLinkXeq.hh.

Referenced by XrdLinkCtl::Alloc(), Client(), XrdLinkCtl::Find(), and XrdLinkCtl::getName().

◆ isIdle

char XrdLinkXeq::isIdle
protected

◆ KeepFD

bool XrdLinkXeq::KeepFD
protected

Definition at line 198 of file XrdLinkXeq.hh.

Referenced by XrdLinkCtl::Alloc(), Close(), Reset(), and Shutdown().

◆ LinkBytesIn

long long XrdLinkXeq::LinkBytesIn = 0
staticprotected

Definition at line 161 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ LinkBytesOut

long long XrdLinkXeq::LinkBytesOut = 0
staticprotected

Definition at line 162 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ LinkConTime

long long XrdLinkXeq::LinkConTime = 0
staticprotected

Definition at line 163 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ LinkCount

int XrdLinkXeq::LinkCount = 0
staticprotected

Definition at line 165 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ LinkCountMax

int XrdLinkXeq::LinkCountMax = 0
staticprotected

Definition at line 166 of file XrdLinkXeq.hh.

Referenced by Stats().

◆ LinkCountTot

long long XrdLinkXeq::LinkCountTot = 0
staticprotected

Definition at line 164 of file XrdLinkXeq.hh.

Referenced by Stats().

◆ LinkInfo

◆ LinkSfIntr

int XrdLinkXeq::LinkSfIntr = 0
staticprotected

Definition at line 169 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ LinkStalls

int XrdLinkXeq::LinkStalls = 0
staticprotected

Definition at line 168 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ LinkTimeOuts

int XrdLinkXeq::LinkTimeOuts = 0
staticprotected

Definition at line 167 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ Lname

char XrdLinkXeq::Lname[256]
protected

◆ LockReads

bool XrdLinkXeq::LockReads
protected

Definition at line 197 of file XrdLinkXeq.hh.

Referenced by XrdLinkCtl::Alloc(), Peek(), Recv(), RecvAll(), Reset(), TLS_Peek(), and TLS_Recv().

◆ PollInfo

◆ ProtoAlt

XrdProtocol* XrdLinkXeq::ProtoAlt
protected

Definition at line 184 of file XrdLinkXeq.hh.

Referenced by Close(), Reset(), and setProtocol().

◆ Protocol

XrdProtocol* XrdLinkXeq::Protocol
protected

Definition at line 183 of file XrdLinkXeq.hh.

Referenced by Close(), DoIt(), getProtocol(), Reset(), setProtocol(), and syncStats().

◆ rdMutex

XrdSysMutex XrdLinkXeq::rdMutex
protected

Definition at line 193 of file XrdLinkXeq.hh.

Referenced by Peek(), Recv(), RecvAll(), syncStats(), TLS_Peek(), and TLS_Recv().

◆ sendQ

XrdSendQ* XrdLinkXeq::sendQ
protected

Definition at line 195 of file XrdLinkXeq.hh.

Referenced by Backlog(), Close(), Reset(), Send(), setNB(), and TLS_Send().

◆ SfIntr

int XrdLinkXeq::SfIntr
protected

Definition at line 178 of file XrdLinkXeq.hh.

Referenced by Reset(), Send(), and syncStats().

◆ stallCnt

int XrdLinkXeq::stallCnt
protected

Definition at line 174 of file XrdLinkXeq.hh.

Referenced by getIOStats(), Recv(), Reset(), syncStats(), and TLS_Recv().

◆ stallCntTot

int XrdLinkXeq::stallCntTot
protected

Definition at line 175 of file XrdLinkXeq.hh.

Referenced by getIOStats(), Reset(), and syncStats().

◆ statsMutex

XrdSysMutex XrdLinkXeq::statsMutex
staticprotected

Definition at line 179 of file XrdLinkXeq.hh.

Referenced by Stats(), and syncStats().

◆ tardyCnt

int XrdLinkXeq::tardyCnt
protected

Definition at line 176 of file XrdLinkXeq.hh.

Referenced by getIOStats(), Recv(), Reset(), syncStats(), and TLS_Recv().

◆ tardyCntTot

int XrdLinkXeq::tardyCntTot
protected

Definition at line 177 of file XrdLinkXeq.hh.

Referenced by getIOStats(), Reset(), and syncStats().

◆ tlsIO

XrdTlsSocket XrdLinkXeq::tlsIO
protected

◆ TraceID

const char * XrdLinkXeq::TraceID = "LinkXeq"
staticprotected

Definition at line 157 of file XrdLinkXeq.hh.

◆ Uname

char XrdLinkXeq::Uname[24]
protected

Definition at line 200 of file XrdLinkXeq.hh.

Referenced by XrdLinkCtl::Alloc(), Reset(), and setID().

◆ wrMutex

XrdSysMutex XrdLinkXeq::wrMutex
protected

Definition at line 194 of file XrdLinkXeq.hh.

Referenced by Backlog(), Close(), Send(), setNB(), syncStats(), and TLS_Send().


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