xrootd
XrdSendQ.hh
Go to the documentation of this file.
1#ifndef __XRDSENDQ__H
2#define __XRDSENDQ__H
3/******************************************************************************/
4/* */
5/* X r d S e n d Q . h h */
6/* */
7/* (c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <string.h>
34#include <unistd.h>
35#include <sys/uio.h>
36
37#include "Xrd/XrdJob.hh"
38
39class XrdLink;
40class XrdSysMutex;
41
42class XrdSendQ : public XrdJob
43{
44public:
45
46unsigned int Backlog() {return inQ;}
47
48virtual void DoIt();
49
50static void Init(XrdSysError *eP, XrdScheduler *sP) {Say = eP; Sched = sP;}
51
52 int Send(const char *buff, int blen);
53
54 int Send(const struct iovec *iov, int iovcnt, int iotot);
55
56static void SetAQ(bool onoff) {qPerm = onoff;}
57
58static void SetQM(unsigned int qmVal) {qMax = qmVal;}
59
60static void SetQW(unsigned int qwVal) {qWarn = qwVal;}
61
62 void Terminate(XrdLink *lP=0);
63
65
66private:
67
68virtual ~XrdSendQ() {}
69
70int SendNB(const char *Buff, int Blen);
71int SendNB(const struct iovec *iov, int iocnt, int bytes, int &iovX);
72
73struct mBuff
74{
76int mLen;
77char mData[4]; // Always made long enough
78};
79
80bool QMsg(mBuff *theMsg);
81void RelMsgs(mBuff *mP);
82void Scuttle();
83
86static unsigned int qWarn;
87static unsigned int qMax;
88static bool qPerm;
91
96unsigned int inQ;
97unsigned int qWmsg;
98unsigned short discards;
99bool active;
101};
102#endif
Definition: XrdJob.hh:43
Definition: XrdScheduler.hh:45
Definition: XrdSendQ.hh:43
static unsigned int qMax
Definition: XrdSendQ.hh:87
void Scuttle()
XrdSendQ(XrdLink &lP, XrdSysMutex &mP)
static void SetQW(unsigned int qwVal)
Definition: XrdSendQ.hh:60
mBuff * fMsg
Definition: XrdSendQ.hh:92
bool QMsg(mBuff *theMsg)
mBuff * delQ
Definition: XrdSendQ.hh:94
void Terminate(XrdLink *lP=0)
virtual ~XrdSendQ()
Definition: XrdSendQ.hh:68
static void Init(XrdSysError *eP, XrdScheduler *sP)
Definition: XrdSendQ.hh:50
static unsigned int qWarn
Definition: XrdSendQ.hh:86
mBuff * lMsg
Definition: XrdSendQ.hh:93
int SendNB(const struct iovec *iov, int iocnt, int bytes, int &iovX)
static void SetQM(unsigned int qmVal)
Definition: XrdSendQ.hh:58
XrdSysMutex & wMutex
Definition: XrdSendQ.hh:90
void RelMsgs(mBuff *mP)
static void SetAQ(bool onoff)
Definition: XrdSendQ.hh:56
int SendNB(const char *Buff, int Blen)
int Send(const char *buff, int blen)
unsigned int qWmsg
Definition: XrdSendQ.hh:97
int Send(const struct iovec *iov, int iovcnt, int iotot)
static XrdScheduler * Sched
Definition: XrdSendQ.hh:84
bool active
Definition: XrdSendQ.hh:99
unsigned short discards
Definition: XrdSendQ.hh:98
static bool qPerm
Definition: XrdSendQ.hh:88
unsigned int inQ
Definition: XrdSendQ.hh:96
static XrdSysError * Say
Definition: XrdSendQ.hh:85
unsigned int Backlog()
Definition: XrdSendQ.hh:46
bool terminate
Definition: XrdSendQ.hh:100
int theFD
Definition: XrdSendQ.hh:95
XrdLink & mLink
Definition: XrdSendQ.hh:89
virtual void DoIt()
Definition: XrdSysError.hh:90
Definition: XrdSysPthread.hh:166
Definition: XrdSendQ.hh:74
int mLen
Definition: XrdSendQ.hh:76
mBuff * next
Definition: XrdSendQ.hh:75
char mData[4]
Definition: XrdSendQ.hh:77