xrootd
XrdClXRootDMsgHandler.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // This file is part of the XRootD software suite.
6 //
7 // XRootD is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // XRootD is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // In applying this licence, CERN does not waive the privileges and immunities
21 // granted to it by virtue of its status as an Intergovernmental Organization
22 // or submit itself to any jurisdiction.
23 //------------------------------------------------------------------------------
24 
25 #ifndef __XRD_CL_XROOTD_MSG_HANDLER_HH__
26 #define __XRD_CL_XROOTD_MSG_HANDLER_HH__
27 
30 #include "XrdCl/XrdClDefaultEnv.hh"
31 #include "XrdCl/XrdClMessage.hh"
32 #include "XProtocol/XProtocol.hh"
33 #include "XrdCl/XrdClLog.hh"
34 #include "XrdCl/XrdClConstants.hh"
35 
36 #include "XrdSys/XrdSysPthread.hh"
37 #include "XrdSys/XrdSysPageSize.hh"
39 
40 #include <sys/uio.h>
41 #include <arpa/inet.h> // for network unmarshaling stuff
42 
43 #include <array>
44 #include <list>
45 #include <memory>
46 
47 #if __cplusplus >= 201103L
48 #include <atomic>
49 #endif
50 
51 namespace XrdCl
52 {
53  class PostMaster;
54  class SIDManager;
55  class URL;
56  class LocalFileHandler;
57  class Socket;
58 
59  //----------------------------------------------------------------------------
60  // Single entry in the redirect-trace-back
61  //----------------------------------------------------------------------------
63  {
64  enum Type
65  {
70  };
71 
72  RedirectEntry( const URL &from, const URL &to, Type type ) :
73  from( from ), to( to ), type( type )
74  {
75 
76  }
77 
82 
83  std::string ToString( bool prevok = true )
84  {
85  const std::string tostr = to.GetLocation();
86  const std::string fromstr = from.GetLocation();
87 
88  if( prevok )
89  {
90  switch( type )
91  {
92  case EntryRedirect: return "Redirected from: " + fromstr + " to: "
93  + tostr;
94 
95  case EntryRedirectOnWait: return "Server responded with wait. "
96  "Falling back to virtual redirector: " + tostr;
97 
98  case EntryRetry: return "Retrying: " + tostr;
99 
100  case EntryWait: return "Waited at server request. Resending: "
101  + tostr;
102  }
103  }
104  return "Failed at: " + fromstr + ", retrying at: " + tostr;
105  }
106  };
107 
108  //----------------------------------------------------------------------------
110  //----------------------------------------------------------------------------
112  public OutgoingMsgHandler
113  {
114  friend class HandleRspJob;
115 
116  public:
117  //------------------------------------------------------------------------
126  //------------------------------------------------------------------------
128  ResponseHandler *respHandler,
129  const URL *url,
130  std::shared_ptr<SIDManager> sidMgr,
131  LocalFileHandler *lFileHandler):
132  pRequest( msg ),
133  pResponse( 0 ),
134  pResponseHandler( respHandler ),
135  pUrl( *url ),
137  pSidMgr( sidMgr ),
138  pLFileHandler( lFileHandler ),
139  pExpiration( 0 ),
140  pRedirectAsAnswer( false ),
141  pOksofarAsAnswer( false ),
142  pHosts( 0 ),
143  pHasLoadBalancer( false ),
144  pHasSessionId( false ),
145  pChunkList( 0 ),
146  pRedirectCounter( 0 ),
148 
149  pAsyncOffset( 0 ),
150  pAsyncChunkOffset( 0 ),
151  pAsyncChunkIndex( 0 ),
152  pAsyncReadSize( 0 ),
153  pAsyncReadBuffer( 0 ),
154  pAsyncMsgSize( 0 ),
155 
156  pReadRawStarted( false ),
158 
159  pReadVRawMsgOffset( 0 ),
160  pReadVRawChunkHeaderDone( false ),
162  pReadVRawSizeError( false ),
163  pReadVRawChunkIndex( 0 ),
164  pReadVRawMsgDiscard( false ),
165 
166  pOtherRawStarted( false ),
167 
168  pFollowMetalink( false ),
169 
170  pStateful( false ),
171 
172  pAggregatedWaitTime( 0 ),
173 
174  pMsgInFly( false ),
175 
176  pTimeoutFence( false ),
177 
178  pDirListStarted( false ),
179  pDirListWithStat( false ),
180 
181  pCV( 0 )
182 
183  {
185  if( msg->GetSessionId() )
186  pHasSessionId = true;
187  memset( &pReadVRawChunkHeader, 0, sizeof( readahead_list ) );
188 
189  Log *log = DefaultEnv::GetLog();
190  log->Debug( ExDbgMsg, "[%s] MsgHandler created: 0x%x (message: %s ).",
191  pUrl.GetHostId().c_str(), this,
192  pRequest->GetDescription().c_str() );
193 
195  if( ntohs( hdr->requestid ) == kXR_pgread )
196  {
198  pPgReadCksums.reserve( NbPages( ntohl( pgrdreq->rlen ) ) );
199  }
200  }
201 
202  //------------------------------------------------------------------------
204  //------------------------------------------------------------------------
206  {
208 
209  if( !pHasSessionId )
210  delete pRequest;
211  delete pResponse;
212  std::vector<Message *>::iterator it;
213  for( it = pPartialResps.begin(); it != pPartialResps.end(); ++it )
214  delete *it;
215 
217 
218  pRequest = reinterpret_cast<Message*>( 0xDEADBEEF );
219  pResponse = reinterpret_cast<Message*>( 0xDEADBEEF );
220  pResponseHandler = reinterpret_cast<ResponseHandler*>( 0xDEADBEEF );
221  pPostMaster = reinterpret_cast<PostMaster*>( 0xDEADBEEF );
222  pLFileHandler = reinterpret_cast<LocalFileHandler*>( 0xDEADBEEF );
223  pHosts = reinterpret_cast<HostList*>( 0xDEADBEEF );
224  pChunkList = reinterpret_cast<ChunkList*>( 0xDEADBEEF );
225  pEffectiveDataServerUrl = reinterpret_cast<URL*>( 0xDEADBEEF );
226 
227  Log *log = DefaultEnv::GetLog();
228  log->Debug( ExDbgMsg, "[%s] Destroying MsgHandler: 0x%x.",
229  pUrl.GetHostId().c_str(), this );
230  }
231 
232  //------------------------------------------------------------------------
238  //------------------------------------------------------------------------
239  virtual uint16_t Examine( Message *msg );
240 
241  //------------------------------------------------------------------------
250  //------------------------------------------------------------------------
251  virtual uint16_t InspectStatusRsp( Message *msg );
252 
253  //------------------------------------------------------------------------
257  //------------------------------------------------------------------------
258  virtual uint16_t GetSid() const;
259 
260  //------------------------------------------------------------------------
264  //------------------------------------------------------------------------
265  virtual void Process( Message *msg );
266 
267  //------------------------------------------------------------------------
277  //------------------------------------------------------------------------
278  virtual Status ReadMessageBody( Message *msg,
279  Socket *socket,
280  uint32_t &bytesRead );
281 
282  //------------------------------------------------------------------------
288  //------------------------------------------------------------------------
289  virtual uint8_t OnStreamEvent( StreamEvent event,
290  XRootDStatus status );
291 
292  //------------------------------------------------------------------------
294  //------------------------------------------------------------------------
295  virtual void OnStatusReady( const Message *message,
296  XRootDStatus status );
297 
298  //------------------------------------------------------------------------
300  //------------------------------------------------------------------------
301  virtual bool IsRaw() const;
302 
303  //------------------------------------------------------------------------
312  //------------------------------------------------------------------------
313  Status WriteMessageBody( Socket *socket,
314  uint32_t &bytesWritten );
315 
316  //------------------------------------------------------------------------
320  //------------------------------------------------------------------------
321  void WaitDone( time_t now );
322 
323  //------------------------------------------------------------------------
325  //------------------------------------------------------------------------
326  void SetExpiration( time_t expiration )
327  {
328  pExpiration = expiration;
329  }
330 
331  //------------------------------------------------------------------------
334  //------------------------------------------------------------------------
335  void SetRedirectAsAnswer( bool redirectAsAnswer )
336  {
337  pRedirectAsAnswer = redirectAsAnswer;
338  }
339 
340  //------------------------------------------------------------------------
343  //------------------------------------------------------------------------
344  void SetOksofarAsAnswer( bool oksofarAsAnswer )
345  {
346  pOksofarAsAnswer = oksofarAsAnswer;
347  }
348 
349  //------------------------------------------------------------------------
351  //------------------------------------------------------------------------
352  const Message *GetRequest() const
353  {
354  return pRequest;
355  }
356 
357  //------------------------------------------------------------------------
359  //------------------------------------------------------------------------
360  void SetLoadBalancer( const HostInfo &loadBalancer )
361  {
362  if( !loadBalancer.url.IsValid() )
363  return;
364  pLoadBalancer = loadBalancer;
365  pHasLoadBalancer = true;
366  }
367 
368  //------------------------------------------------------------------------
370  //------------------------------------------------------------------------
371  void SetHostList( HostList *hostList )
372  {
373  delete pHosts;
374  pHosts = hostList;
375  }
376 
377  //------------------------------------------------------------------------
379  //------------------------------------------------------------------------
380  void SetChunkList( ChunkList *chunkList )
381  {
382  pChunkList = chunkList;
383  if( chunkList )
384  pChunkStatus.resize( chunkList->size() );
385  else
386  pChunkStatus.clear();
387  }
388 
389  //------------------------------------------------------------------------
391  //------------------------------------------------------------------------
393  {
394  pKBuff = kbuff;
395  }
396 
397  //------------------------------------------------------------------------
399  //------------------------------------------------------------------------
400  void SetRedirectCounter( uint16_t redirectCounter )
401  {
402  pRedirectCounter = redirectCounter;
403  }
404 
405  void SetFollowMetalink( bool followMetalink )
406  {
407  pFollowMetalink = followMetalink;
408  }
409 
410  void SetStateful( bool stateful )
411  {
412  pStateful = stateful;
413  }
414 
415  //------------------------------------------------------------------------
417  //------------------------------------------------------------------------
418  void TakeDownTimeoutFence();
419 
420  private:
421 
422  //------------------------------------------------------------------------
424  //------------------------------------------------------------------------
425  Status ReadRawRead( Message *msg,
426  Socket *socket,
427  uint32_t &bytesRead );
428 
429  //------------------------------------------------------------------------
431  //------------------------------------------------------------------------
433  Socket *socket,
434  uint32_t &bytesRead );
435 
436  //------------------------------------------------------------------------
438  //------------------------------------------------------------------------
440  Socket *socket,
441  uint32_t &bytesRead );
442 
443  //------------------------------------------------------------------------
445  //------------------------------------------------------------------------
447  Socket *socket,
448  uint32_t &bytesRead );
449 
450  //------------------------------------------------------------------------
453  //------------------------------------------------------------------------
454  inline Status ReadAsync( Socket *socket, uint32_t &bytesRead )
455  {
456  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
457  uint32_t btsRead = 0;
458  Status st = ReadBytesAsync( socket, pAsyncReadBuffer, toBeRead, btsRead );
459  pAsyncOffset += btsRead;
460  bytesRead += btsRead;
461  return st;
462  }
463 
464  //------------------------------------------------------------------------
467  //------------------------------------------------------------------------
468  inline Status ReadPagesAsync( Socket *socket, uint32_t &bytesRead )
469  {
470  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
471  while( toBeRead > 0 )
472  {
473  uint32_t btsRead = 0;
474  Status st = ReadPageAsync( socket, btsRead );
475  if( !st.IsOK() || st.code == suRetry ) return st;
476  bytesRead += btsRead;
477  toBeRead -= btsRead;
478  }
479 
480  return Status();
481  }
482 
483  //------------------------------------------------------------------------
486  //------------------------------------------------------------------------
487  Status ReadPageAsync( Socket *socket, uint32_t &bytesRead );
488 
489  //------------------------------------------------------------------------
491  //------------------------------------------------------------------------
492  static Status ReadBytesAsync( Socket *socket, char *&buffer,
493  uint32_t toBeRead, uint32_t &bytesRead );
494 
495  //------------------------------------------------------------------------
497  //------------------------------------------------------------------------
498  void HandleError( XRootDStatus status, Message *msg = 0 );
499 
500  //------------------------------------------------------------------------
502  //------------------------------------------------------------------------
503  Status RetryAtServer( const URL &url, RedirectEntry::Type entryType );
504 
505  //------------------------------------------------------------------------
507  //------------------------------------------------------------------------
508  void HandleResponse();
509 
510  //------------------------------------------------------------------------
512  //------------------------------------------------------------------------
514 
515  //------------------------------------------------------------------------
518  //------------------------------------------------------------------------
519  Status ParseResponse( AnyObject *&response );
520 
521  //------------------------------------------------------------------------
524  //------------------------------------------------------------------------
525  Status ParseXAttrResponse( char *data, size_t len, AnyObject *&response );
526 
527  //------------------------------------------------------------------------
530  //------------------------------------------------------------------------
531  Status RewriteRequestRedirect( const URL &newUrl );
532 
533  //------------------------------------------------------------------------
535  //------------------------------------------------------------------------
537 
538  //------------------------------------------------------------------------
540  //------------------------------------------------------------------------
541  Status PostProcessReadV( VectorReadInfo *vReadInfo );
542 
543  //------------------------------------------------------------------------
545  //------------------------------------------------------------------------
547 
548  //------------------------------------------------------------------------
550  //------------------------------------------------------------------------
551  void UpdateTriedCGI(uint32_t errNo=0);
552 
553  //------------------------------------------------------------------------
555  //------------------------------------------------------------------------
556  void SwitchOnRefreshFlag();
557 
558  //------------------------------------------------------------------------
561  //------------------------------------------------------------------------
562  void HandleRspOrQueue();
563 
564  //------------------------------------------------------------------------
566  //------------------------------------------------------------------------
567  void HandleLocalRedirect( URL *url );
568 
569  //------------------------------------------------------------------------
574  //------------------------------------------------------------------------
575  bool IsRetriable( Message *request );
576 
577  //------------------------------------------------------------------------
584  //------------------------------------------------------------------------
585  bool OmitWait( Message *request, const URL &url );
586 
587  //------------------------------------------------------------------------
593  //------------------------------------------------------------------------
594  bool RetriableErrorResponse( const Status &status );
595 
596  //------------------------------------------------------------------------
598  //------------------------------------------------------------------------
599  void DumpRedirectTraceBack();
600 
607  //------------------------------------------------------------------------
608  template<typename T>
609  Status ReadFromBuffer( char *&buffer, size_t &buflen, T& result );
610 
611  //------------------------------------------------------------------------
618  //------------------------------------------------------------------------
619  Status ReadFromBuffer( char *&buffer, size_t &buflen, std::string &result );
620 
621  //------------------------------------------------------------------------
629  //------------------------------------------------------------------------
630  Status ReadFromBuffer( char *&buffer, size_t &buflen, size_t size,
631  std::string &result );
632 
633  //------------------------------------------------------------------------
634  // Helper struct for async reading of chunks
635  //------------------------------------------------------------------------
636  struct ChunkStatus
637  {
638  ChunkStatus(): sizeError( false ), done( false ) {}
639  bool sizeError;
640  bool done;
641  };
642 
643  typedef std::list<std::unique_ptr<RedirectEntry>> RedirectTraceBack;
644 
645  static const size_t PageSize = XrdSys::PageSize;
646  static const size_t CksumSize = sizeof( uint32_t );
647  static const size_t PageWithCksum = PageSize + CksumSize;
648 
649  inline static size_t NbPages( uint32_t dlen )
650  {
651  size_t nbpages = dlen / PageWithCksum;
652  if( dlen % PageWithCksum ) ++nbpages;
653  return nbpages;
654  }
655 
656  inline void Copy( uint32_t offchlst, char *buffer, size_t length )
657  {
658  auto itr = pChunkList->begin();
659  while( length > 0 )
660  {
661  // first find the right buffer
662  char *dstbuf = nullptr;
663  size_t cplen = 0;
664  for( ; itr != pChunkList->end() ; ++itr )
665  {
666  if( offchlst < itr->offset ||
667  offchlst >= itr->offset + itr->length )
668  continue;
669  size_t dstoff = offchlst - itr->offset;
670  dstbuf = reinterpret_cast<char*>( itr->buffer ) + dstoff;
671  cplen = itr->length - cplen;
672  break;
673  }
674  // now do the copy
675  if( cplen > length ) cplen = length;
676  memcpy( dstbuf, buffer, cplen );
677  buffer += cplen;
678  length -= cplen;
679  }
680  }
681 
684  std::vector<Message *> pPartialResps;
689  std::shared_ptr<SIDManager> pSidMgr;
693  time_t pExpiration;
700  std::string pRedirectUrl;
703  std::vector<ChunkStatus> pChunkStatus;
706 
707  uint32_t pAsyncOffset;
710  uint32_t pAsyncReadSize;
712  uint32_t pAsyncMsgSize;
713 
716 
717  std::array<char, 4> pPgReadCksumBuff;
718  std::vector<uint32_t> pPgReadCksums;
719 
727 
729 
731 
732  bool pStateful;
734 
735  std::unique_ptr<RedirectEntry> pRdirEntry;
737 
738  bool pMsgInFly;
739 
740  //------------------------------------------------------------------------
741  // true if MsgHandler is both in inQueue and installed in respective
742  // Stream (this could happen if server gave oksofar response), otherwise
743  // false
744  //------------------------------------------------------------------------
745 #if __cplusplus >= 201103L
746  std::atomic<bool> pTimeoutFence;
747 #else
749 #endif
750 
751  //------------------------------------------------------------------------
752  // if we are serving chunked data to the user's handler in case of
753  // kXR_dirlist we need to memorize if the response contains stat info or
754  // not (the information is only encoded in the first chunk)
755  //------------------------------------------------------------------------
758 
759  //------------------------------------------------------------------------
760  // synchronization is needed in case the MsgHandler has been configured
761  // to serve kXR_oksofar as a response to the user's handler
762  //------------------------------------------------------------------------
764  };
765 }
766 
767 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:709
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:728
void HandleError(XRootDStatus status, Message *msg=0)
Recover error.
std::vector< Message * > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:684
Definition: XrdClAnyObject.hh:32
URL to
Definition: XrdClXRootDMsgHandler.hh:79
Status ReadRawReadV(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_readv in raw mode.
void UpdateTriedCGI(uint32_t errNo=0)
Update the "tried=" part of the CGI of the current message.
virtual uint16_t GetSid() const
const uint64_t ExDbgMsg
Definition: XrdClConstants.hh:43
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:970
Status RetryAtServer(const URL &url, RedirectEntry::Type entryType)
Retry the request at another server.
PostMaster * pPostMaster
Definition: XrdClXRootDMsgHandler.hh:688
void Copy(uint32_t offchlst, char *buffer, size_t length)
Definition: XrdClXRootDMsgHandler.hh:656
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Definition: XProtocol.hh:651
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:638
bool RetriableErrorResponse(const Status &status)
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
Definition: XrdClBuffer.hh:72
Status ReadPagesAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:468
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
Definition: XrdClXRootDMsgHandler.hh:400
bool pReadRawStarted
Definition: XrdClXRootDMsgHandler.hh:714
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:205
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:405
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:736
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:647
URL from
Definition: XrdClXRootDMsgHandler.hh:78
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:690
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:705
std::string ToString(bool prevok=true)
Definition: XrdClXRootDMsgHandler.hh:83
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:74
std::vector< ChunkStatus > pChunkStatus
Definition: XrdClXRootDMsgHandler.hh:703
std::string GetLocation() const
Get location (protocol://host:port/path)
kXR_unt16 requestid
Definition: XProtocol.hh:156
Definition: XrdClXRootDMsgHandler.hh:636
uint16_t code
Error type, or additional hints on what to do.
Definition: XrdClStatus.hh:140
XRootDMsgHandler(Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler)
Definition: XrdClXRootDMsgHandler.hh:127
kXR_int32 rlen
Definition: XProtocol.hh:505
bool IsOK() const
We&#39;re fine.
Definition: XrdClStatus.hh:122
uint32_t pReadVRawMsgOffset
Definition: XrdClXRootDMsgHandler.hh:720
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:114
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
Definition: XrdClXRootDMsgHandler.hh:392
static Status ReadBytesAsync(Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead)
Read a buffer asynchronously.
bool pReadVRawChunkHeaderDone
Definition: XrdClXRootDMsgHandler.hh:721
Status ParseResponse(AnyObject *&response)
StreamEvent
Events that may have occurred to the stream.
Definition: XrdClPostMasterInterfaces.hh:98
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
Definition: XrdClURL.hh:94
bool pFollowMetalink
Definition: XrdClXRootDMsgHandler.hh:730
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
bool done
Definition: XrdClXRootDMsgHandler.hh:640
Procedure execution status.
Definition: XrdClStatus.hh:112
static const size_t CksumSize
Definition: XrdClXRootDMsgHandler.hh:646
Status RewriteRequestRedirect(const URL &newUrl)
Status ReadRawPgRead(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_pgread in raw mode.
URL pUrl
Definition: XrdClXRootDMsgHandler.hh:686
virtual void Process(Message *msg)
Status ReadRawRead(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_read in raw mode.
virtual void OnStatusReady(const Message *message, XRootDStatus status)
The requested action has been performed and the status is available.
Message * pRequest
Definition: XrdClXRootDMsgHandler.hh:682
Status UnPackReadVResponse(Message *msg)
Unpack a single readv response.
Definition: XrdClXRootDMsgHandler.hh:67
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:693
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:326
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:704
static const size_t PageSize
Definition: XrdClXRootDMsgHandler.hh:645
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:689
static Log * GetLog()
Get default log.
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:699
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:701
Definition: XrdClXRootDResponses.hh:1023
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:711
Definition: XProtocol.hh:500
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1035
virtual uint16_t Examine(Message *msg)
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:695
Status ReadRawOther(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle anything other than kXR_read and kXR_readv in raw mode.
bool pDirListWithStat
Definition: XrdClXRootDMsgHandler.hh:757
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:643
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition: XrdClMessage.hh:90
Definition: XrdSysPthread.hh:78
XrdSys::KernelBuffer * pKBuff
Definition: XrdClXRootDMsgHandler.hh:702
std::vector< uint32_t > pPgReadCksums
Definition: XrdClXRootDMsgHandler.hh:718
bool pReadVRawMsgDiscard
Definition: XrdClXRootDMsgHandler.hh:726
static const int PageSize
Definition: XrdSysPageSize.hh:36
Message * pResponse
Definition: XrdClXRootDMsgHandler.hh:683
RedirectEntry(const URL &from, const URL &to, Type type)
Definition: XrdClXRootDMsgHandler.hh:72
bool IsValid() const
Is the url valid.
static size_t NbPages(uint32_t dlen)
Definition: XrdClXRootDMsgHandler.hh:649
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:691
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:81
Request status.
Definition: XrdClXRootDResponses.hh:218
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:687
Definition: XrdClAnyObject.hh:25
Status ReadPageAsync(Socket *socket, uint32_t &bytesRead)
void TakeDownTimeoutFence()
Take down the timeout fence after oksofar response has been handled.
Status PostProcessReadV(VectorReadInfo *vReadInfo)
Post process vector read.
Message handler.
Definition: XrdClPostMasterInterfaces.hh:71
Type type
Definition: XrdClXRootDMsgHandler.hh:80
int pAggregatedWaitTime
Definition: XrdClXRootDMsgHandler.hh:733
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:380
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:756
void SetRedirectAsAnswer(bool redirectAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:335
Definition: XProtocol.hh:141
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:700
Definition: XrdSysKernelBuffer.hh:45
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1032
Definition: XProtocol.hh:154
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:639
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:694
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:732
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
Vector read info.
Definition: XrdClXRootDResponses.hh:975
Handle an async response.
Definition: XrdClXRootDResponses.hh:1040
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:410
Definition: XrdClLocalFileHandler.hh:32
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:712
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:352
virtual bool IsRaw() const
Are we a raw writer or not?
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:710
URL representation.
Definition: XrdClURL.hh:30
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:707
bool OmitWait(Message *request, const URL &url)
bool pReadVRawSizeError
Definition: XrdClXRootDMsgHandler.hh:723
Status WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:735
HostList * pHosts
Definition: XrdClXRootDMsgHandler.hh:696
int32_t pReadVRawChunkIndex
Definition: XrdClXRootDMsgHandler.hh:724
Definition: XrdClXRootDMsgHandler.hh:66
void WaitDone(time_t now)
virtual uint8_t OnStreamEvent(StreamEvent event, XRootDStatus status)
XRootDStatus * ProcessStatus()
Extract the status information from the stuff that we got.
std::array< char, 4 > pPgReadCksumBuff
Definition: XrdClXRootDMsgHandler.hh:717
Status pLastError
Definition: XrdClXRootDMsgHandler.hh:692
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:715
Message status handler.
Definition: XrdClPostMasterInterfaces.hh:184
const uint16_t suRetry
Definition: XrdClStatus.hh:40
virtual Status ReadMessageBody(Message *msg, Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:69
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:47
Type
Definition: XrdClXRootDMsgHandler.hh:64
bool pReadVRawChunkHeaderStarted
Definition: XrdClXRootDMsgHandler.hh:722
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:698
static PostMaster * GetPostMaster()
Get default post master.
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:111
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:763
bool IsRetriable(Message *request)
void Debug(uint64_t topic, const char *format,...)
Print a debug message.
void HandleResponse()
Unpack the message and call the response handler.
bool pHasLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:697
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:685
Definition: XrdClXRootDMsgHandler.hh:62
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:738
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:454
bool pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:748
A network socket.
Definition: XrdClSocket.hh:41
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:344
void DumpRedirectTraceBack()
Dump the redirect-trace-back into the log file.
virtual uint16_t InspectStatusRsp(Message *msg)
Handle diagnostics.
Definition: XrdClLog.hh:102
void SetLoadBalancer(const HostInfo &loadBalancer)
Set the load balancer.
Definition: XrdClXRootDMsgHandler.hh:360
uint32_t pAsyncChunkOffset
Definition: XrdClXRootDMsgHandler.hh:708
Definition: XrdClXRootDMsgHandler.hh:68
readahead_list pReadVRawChunkHeader
Definition: XrdClXRootDMsgHandler.hh:725
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:371