xrootd
Loading...
Searching...
No Matches
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 <cstring>
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
50 int Send(const char *buff, int blen);
51
52 int Send(const struct iovec *iov, int iovcnt, int iotot);
53
54static void SetAQ(bool onoff) {qPerm = onoff;}
55
56static void SetQM(unsigned int qmVal) {qMax = qmVal;}
57
58static void SetQW(unsigned int qwVal) {qWarn = qwVal;}
59
60 void Terminate(XrdLink *lP=0);
61
63
64private:
65
66virtual ~XrdSendQ() {}
67
68int SendNB(const char *Buff, int Blen);
69int SendNB(const struct iovec *iov, int iocnt, int bytes, int &iovX);
70
71struct mBuff
72{
74int mLen;
75char mData[4]; // Always made long enough
76};
77
78bool QMsg(mBuff *theMsg);
79void RelMsgs(mBuff *mP);
80void Scuttle();
81
82static unsigned int qWarn;
83static unsigned int qMax;
84static bool qPerm;
87
92unsigned int inQ;
93unsigned int qWmsg;
94unsigned short discards;
95bool active;
97};
98#endif
Definition XrdJob.hh:43
Definition XrdSendQ.hh:43
static unsigned int qMax
Definition XrdSendQ.hh:83
void Scuttle()
XrdSendQ(XrdLink &lP, XrdSysMutex &mP)
static void SetQW(unsigned int qwVal)
Definition XrdSendQ.hh:58
mBuff * fMsg
Definition XrdSendQ.hh:88
bool QMsg(mBuff *theMsg)
mBuff * delQ
Definition XrdSendQ.hh:90
void Terminate(XrdLink *lP=0)
virtual ~XrdSendQ()
Definition XrdSendQ.hh:66
static unsigned int qWarn
Definition XrdSendQ.hh:82
mBuff * lMsg
Definition XrdSendQ.hh:89
int SendNB(const struct iovec *iov, int iocnt, int bytes, int &iovX)
static void SetQM(unsigned int qmVal)
Definition XrdSendQ.hh:56
XrdSysMutex & wMutex
Definition XrdSendQ.hh:86
void RelMsgs(mBuff *mP)
static void SetAQ(bool onoff)
Definition XrdSendQ.hh:54
int SendNB(const char *Buff, int Blen)
int Send(const char *buff, int blen)
unsigned int qWmsg
Definition XrdSendQ.hh:93
int Send(const struct iovec *iov, int iovcnt, int iotot)
bool active
Definition XrdSendQ.hh:95
unsigned short discards
Definition XrdSendQ.hh:94
static bool qPerm
Definition XrdSendQ.hh:84
unsigned int inQ
Definition XrdSendQ.hh:92
unsigned int Backlog()
Definition XrdSendQ.hh:46
bool terminate
Definition XrdSendQ.hh:96
int theFD
Definition XrdSendQ.hh:91
XrdLink & mLink
Definition XrdSendQ.hh:85
virtual void DoIt()
Definition XrdSysPthread.hh:165
Definition XrdSendQ.hh:72
int mLen
Definition XrdSendQ.hh:74
mBuff * next
Definition XrdSendQ.hh:73
char mData[4]
Definition XrdSendQ.hh:75
Definition XrdOucIOVec.hh:65