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{
73mBuff *next;
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;
85XrdLink &mLink;
86XrdSysMutex &wMutex;
87
88mBuff *fMsg;
89mBuff *lMsg;
90mBuff *delQ;
91int theFD;
92unsigned int inQ;
93unsigned int qWmsg;
94unsigned short discards;
95bool active;
96bool terminate;
97};
98#endif
XrdSendQ(XrdLink &lP, XrdSysMutex &mP)
Definition XrdSendQ.cc:91
static void SetQW(unsigned int qwVal)
Definition XrdSendQ.hh:58
void Terminate(XrdLink *lP=0)
Definition XrdSendQ.cc:396
static void SetQM(unsigned int qmVal)
Definition XrdSendQ.hh:56
static void SetAQ(bool onoff)
Definition XrdSendQ.hh:54
int Send(const char *buff, int blen)
Definition XrdSendQ.cc:230
unsigned int Backlog()
Definition XrdSendQ.hh:46
virtual void DoIt()
Definition XrdSendQ.cc:102