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  pAsyncChunkIndex( 0 ),
151  pAsyncReadSize( 0 ),
152  pAsyncReadBuffer( 0 ),
153  pAsyncMsgSize( 0 ),
154 
155  pReadRawStarted( false ),
157 
158  pReadVRawMsgOffset( 0 ),
159  pReadVRawChunkHeaderDone( false ),
161  pReadVRawSizeError( false ),
162  pReadVRawChunkIndex( 0 ),
163  pReadVRawMsgDiscard( false ),
164 
165  pOtherRawStarted( false ),
166 
167  pFollowMetalink( false ),
168 
169  pStateful( false ),
170 
171  pAggregatedWaitTime( 0 ),
172 
173  pMsgInFly( false ),
174 
175  pTimeoutFence( false ),
176 
177  pDirListStarted( false ),
178  pDirListWithStat( false ),
179 
180  pCV( 0 )
181 
182  {
184  if( msg->GetSessionId() )
185  pHasSessionId = true;
186  memset( &pReadVRawChunkHeader, 0, sizeof( readahead_list ) );
187 
188  Log *log = DefaultEnv::GetLog();
189  log->Debug( ExDbgMsg, "[%s] MsgHandler created: 0x%x (message: %s ).",
190  pUrl.GetHostId().c_str(), this,
191  pRequest->GetDescription().c_str() );
192 
194  if( ntohs( hdr->requestid ) == kXR_pgread )
195  {
197  pPgReadCksums.reserve( NbPages( ntohl( pgrdreq->rlen ) ) );
198  }
199  }
200 
201  //------------------------------------------------------------------------
203  //------------------------------------------------------------------------
205  {
207 
208  if( !pHasSessionId )
209  delete pRequest;
210  delete pResponse;
211  std::vector<Message *>::iterator it;
212  for( it = pPartialResps.begin(); it != pPartialResps.end(); ++it )
213  delete *it;
214 
216 
217  pRequest = reinterpret_cast<Message*>( 0xDEADBEEF );
218  pResponse = reinterpret_cast<Message*>( 0xDEADBEEF );
219  pResponseHandler = reinterpret_cast<ResponseHandler*>( 0xDEADBEEF );
220  pPostMaster = reinterpret_cast<PostMaster*>( 0xDEADBEEF );
221  pLFileHandler = reinterpret_cast<LocalFileHandler*>( 0xDEADBEEF );
222  pHosts = reinterpret_cast<HostList*>( 0xDEADBEEF );
223  pChunkList = reinterpret_cast<ChunkList*>( 0xDEADBEEF );
224  pEffectiveDataServerUrl = reinterpret_cast<URL*>( 0xDEADBEEF );
225 
226  Log *log = DefaultEnv::GetLog();
227  log->Debug( ExDbgMsg, "[%s] Destroying MsgHandler: 0x%x.",
228  pUrl.GetHostId().c_str(), this );
229  }
230 
231  //------------------------------------------------------------------------
237  //------------------------------------------------------------------------
238  virtual uint16_t Examine( Message *msg );
239 
240  //------------------------------------------------------------------------
249  //------------------------------------------------------------------------
250  virtual uint16_t InspectStatusRsp( Message *msg );
251 
252  //------------------------------------------------------------------------
256  //------------------------------------------------------------------------
257  virtual uint16_t GetSid() const;
258 
259  //------------------------------------------------------------------------
263  //------------------------------------------------------------------------
264  virtual void Process( Message *msg );
265 
266  //------------------------------------------------------------------------
276  //------------------------------------------------------------------------
277  virtual Status ReadMessageBody( Message *msg,
278  Socket *socket,
279  uint32_t &bytesRead );
280 
281  //------------------------------------------------------------------------
287  //------------------------------------------------------------------------
288  virtual uint8_t OnStreamEvent( StreamEvent event,
289  XRootDStatus status );
290 
291  //------------------------------------------------------------------------
293  //------------------------------------------------------------------------
294  virtual void OnStatusReady( const Message *message,
295  XRootDStatus status );
296 
297  //------------------------------------------------------------------------
299  //------------------------------------------------------------------------
300  virtual bool IsRaw() const;
301 
302  //------------------------------------------------------------------------
311  //------------------------------------------------------------------------
312  Status WriteMessageBody( Socket *socket,
313  uint32_t &bytesWritten );
314 
315  //------------------------------------------------------------------------
319  //------------------------------------------------------------------------
320  void WaitDone( time_t now );
321 
322  //------------------------------------------------------------------------
324  //------------------------------------------------------------------------
325  void SetExpiration( time_t expiration )
326  {
327  pExpiration = expiration;
328  }
329 
330  //------------------------------------------------------------------------
333  //------------------------------------------------------------------------
334  void SetRedirectAsAnswer( bool redirectAsAnswer )
335  {
336  pRedirectAsAnswer = redirectAsAnswer;
337  }
338 
339  //------------------------------------------------------------------------
342  //------------------------------------------------------------------------
343  void SetOksofarAsAnswer( bool oksofarAsAnswer )
344  {
345  pOksofarAsAnswer = oksofarAsAnswer;
346  }
347 
348  //------------------------------------------------------------------------
350  //------------------------------------------------------------------------
351  const Message *GetRequest() const
352  {
353  return pRequest;
354  }
355 
356  //------------------------------------------------------------------------
358  //------------------------------------------------------------------------
359  void SetLoadBalancer( const HostInfo &loadBalancer )
360  {
361  if( !loadBalancer.url.IsValid() )
362  return;
363  pLoadBalancer = loadBalancer;
364  pHasLoadBalancer = true;
365  }
366 
367  //------------------------------------------------------------------------
369  //------------------------------------------------------------------------
370  void SetHostList( HostList *hostList )
371  {
372  delete pHosts;
373  pHosts = hostList;
374  }
375 
376  //------------------------------------------------------------------------
378  //------------------------------------------------------------------------
379  void SetChunkList( ChunkList *chunkList )
380  {
381  pChunkList = chunkList;
382  if( chunkList )
383  pChunkStatus.resize( chunkList->size() );
384  else
385  pChunkStatus.clear();
386  }
387 
388  //------------------------------------------------------------------------
390  //------------------------------------------------------------------------
392  {
393  pKBuff = kbuff;
394  }
395 
396  //------------------------------------------------------------------------
398  //------------------------------------------------------------------------
399  void SetRedirectCounter( uint16_t redirectCounter )
400  {
401  pRedirectCounter = redirectCounter;
402  }
403 
404  void SetFollowMetalink( bool followMetalink )
405  {
406  pFollowMetalink = followMetalink;
407  }
408 
409  void SetStateful( bool stateful )
410  {
411  pStateful = stateful;
412  }
413 
414  //------------------------------------------------------------------------
416  //------------------------------------------------------------------------
417  void TakeDownTimeoutFence();
418 
419  private:
420 
421  //------------------------------------------------------------------------
423  //------------------------------------------------------------------------
424  Status ReadRawRead( Message *msg,
425  Socket *socket,
426  uint32_t &bytesRead );
427 
428  //------------------------------------------------------------------------
430  //------------------------------------------------------------------------
432  Socket *socket,
433  uint32_t &bytesRead );
434 
435  //------------------------------------------------------------------------
437  //------------------------------------------------------------------------
439  Socket *socket,
440  uint32_t &bytesRead );
441 
442  //------------------------------------------------------------------------
444  //------------------------------------------------------------------------
446  Socket *socket,
447  uint32_t &bytesRead );
448 
449  //------------------------------------------------------------------------
452  //------------------------------------------------------------------------
453  inline Status ReadAsync( Socket *socket, uint32_t &bytesRead )
454  {
455  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
456  uint32_t btsRead = 0;
457  Status st = ReadBytesAsync( socket, pAsyncReadBuffer, toBeRead, btsRead );
458  pAsyncOffset += btsRead;
459  bytesRead += btsRead;
460  return st;
461  }
462 
463  //------------------------------------------------------------------------
466  //------------------------------------------------------------------------
467  inline Status ReadPagesAsync( Socket *socket, uint32_t &bytesRead )
468  {
469  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
470  while( toBeRead > 0 )
471  {
472  uint32_t btsRead = 0;
473  Status st = ReadPageAsync( socket, btsRead );
474  if( !st.IsOK() || st.code == suRetry ) return st;
475  bytesRead += btsRead;
476  toBeRead -= btsRead;
477  }
478 
479  return Status();
480  }
481 
482  //------------------------------------------------------------------------
485  //------------------------------------------------------------------------
486  Status ReadPageAsync( Socket *socket, uint32_t &bytesRead );
487 
488  //------------------------------------------------------------------------
490  //------------------------------------------------------------------------
491  static Status ReadBytesAsync( Socket *socket, char *&buffer,
492  uint32_t toBeRead, uint32_t &bytesRead );
493 
494  //------------------------------------------------------------------------
496  //------------------------------------------------------------------------
497  void HandleError( XRootDStatus status, Message *msg = 0 );
498 
499  //------------------------------------------------------------------------
501  //------------------------------------------------------------------------
502  Status RetryAtServer( const URL &url, RedirectEntry::Type entryType );
503 
504  //------------------------------------------------------------------------
506  //------------------------------------------------------------------------
507  void HandleResponse();
508 
509  //------------------------------------------------------------------------
511  //------------------------------------------------------------------------
513 
514  //------------------------------------------------------------------------
517  //------------------------------------------------------------------------
518  Status ParseResponse( AnyObject *&response );
519 
520  //------------------------------------------------------------------------
523  //------------------------------------------------------------------------
524  Status ParseXAttrResponse( char *data, size_t len, AnyObject *&response );
525 
526  //------------------------------------------------------------------------
529  //------------------------------------------------------------------------
530  Status RewriteRequestRedirect( const URL &newUrl );
531 
532  //------------------------------------------------------------------------
534  //------------------------------------------------------------------------
536 
537  //------------------------------------------------------------------------
539  //------------------------------------------------------------------------
540  Status PostProcessReadV( VectorReadInfo *vReadInfo );
541 
542  //------------------------------------------------------------------------
544  //------------------------------------------------------------------------
546 
547  //------------------------------------------------------------------------
549  //------------------------------------------------------------------------
550  void UpdateTriedCGI(uint32_t errNo=0);
551 
552  //------------------------------------------------------------------------
554  //------------------------------------------------------------------------
555  void SwitchOnRefreshFlag();
556 
557  //------------------------------------------------------------------------
560  //------------------------------------------------------------------------
561  void HandleRspOrQueue();
562 
563  //------------------------------------------------------------------------
565  //------------------------------------------------------------------------
566  void HandleLocalRedirect( URL *url );
567 
568  //------------------------------------------------------------------------
573  //------------------------------------------------------------------------
574  bool IsRetriable( Message *request );
575 
576  //------------------------------------------------------------------------
583  //------------------------------------------------------------------------
584  bool OmitWait( Message *request, const URL &url );
585 
586  //------------------------------------------------------------------------
592  //------------------------------------------------------------------------
593  bool RetriableErrorResponse( const Status &status );
594 
595  //------------------------------------------------------------------------
597  //------------------------------------------------------------------------
598  void DumpRedirectTraceBack();
599 
606  //------------------------------------------------------------------------
607  template<typename T>
608  Status ReadFromBuffer( char *&buffer, size_t &buflen, T& result );
609 
610  //------------------------------------------------------------------------
617  //------------------------------------------------------------------------
618  Status ReadFromBuffer( char *&buffer, size_t &buflen, std::string &result );
619 
620  //------------------------------------------------------------------------
628  //------------------------------------------------------------------------
629  Status ReadFromBuffer( char *&buffer, size_t &buflen, size_t size,
630  std::string &result );
631 
632  //------------------------------------------------------------------------
633  // Helper struct for async reading of chunks
634  //------------------------------------------------------------------------
635  struct ChunkStatus
636  {
637  ChunkStatus(): sizeError( false ), done( false ) {}
638  bool sizeError;
639  bool done;
640  };
641 
642  typedef std::list<std::unique_ptr<RedirectEntry>> RedirectTraceBack;
643 
644  static const size_t PageSize = XrdSys::PageSize;
645  static const size_t CksumSize = sizeof( uint32_t );
646  static const size_t PageWithCksum = PageSize + CksumSize;
647 
648  inline static size_t NbPages( uint32_t dlen )
649  {
650  size_t nbpages = dlen / PageWithCksum;
651  if( dlen % PageWithCksum ) ++nbpages;
652  return nbpages;
653  }
654 
657  std::vector<Message *> pPartialResps;
662  std::shared_ptr<SIDManager> pSidMgr;
666  time_t pExpiration;
673  std::string pRedirectUrl;
676  std::vector<ChunkStatus> pChunkStatus;
679 
680  uint32_t pAsyncOffset;
682  uint32_t pAsyncReadSize;
684  uint32_t pAsyncMsgSize;
685 
688 
689  std::array<char, 4> pPgReadCksumBuff;
690  std::vector<uint32_t> pPgReadCksums;
691 
699 
701 
703 
704  bool pStateful;
706 
707  std::unique_ptr<RedirectEntry> pRdirEntry;
709 
710  bool pMsgInFly;
711 
712  //------------------------------------------------------------------------
713  // true if MsgHandler is both in inQueue and installed in respective
714  // Stream (this could happen if server gave oksofar response), otherwise
715  // false
716  //------------------------------------------------------------------------
717 #if __cplusplus >= 201103L
718  std::atomic<bool> pTimeoutFence;
719 #else
721 #endif
722 
723  //------------------------------------------------------------------------
724  // if we are serving chunked data to the user's handler in case of
725  // kXR_dirlist we need to memorize if the response contains stat info or
726  // not (the information is only encoded in the first chunk)
727  //------------------------------------------------------------------------
730 
731  //------------------------------------------------------------------------
732  // synchronization is needed in case the MsgHandler has been configured
733  // to serve kXR_oksofar as a response to the user's handler
734  //------------------------------------------------------------------------
736  };
737 }
738 
739 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:681
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:700
void HandleError(XRootDStatus status, Message *msg=0)
Recover error.
std::vector< Message * > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:657
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:41
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:966
Status RetryAtServer(const URL &url, RedirectEntry::Type entryType)
Retry the request at another server.
PostMaster * pPostMaster
Definition: XrdClXRootDMsgHandler.hh:661
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Definition: XProtocol.hh:636
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:637
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:467
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
Definition: XrdClXRootDMsgHandler.hh:399
bool pReadRawStarted
Definition: XrdClXRootDMsgHandler.hh:686
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:204
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:404
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:708
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:646
URL from
Definition: XrdClXRootDMsgHandler.hh:78
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:663
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:678
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:676
std::string GetLocation() const
Get location (protocol://host:port/path)
kXR_unt16 requestid
Definition: XProtocol.hh:150
Definition: XrdClXRootDMsgHandler.hh:635
uint16_t code
Error type, or additional hints on what to do.
Definition: XrdClStatus.hh:138
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:490
bool IsOK() const
We&#39;re fine.
Definition: XrdClStatus.hh:120
uint32_t pReadVRawMsgOffset
Definition: XrdClXRootDMsgHandler.hh:692
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:114
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
Definition: XrdClXRootDMsgHandler.hh:391
static Status ReadBytesAsync(Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead)
Read a buffer asynchronously.
bool pReadVRawChunkHeaderDone
Definition: XrdClXRootDMsgHandler.hh:693
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:702
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
bool done
Definition: XrdClXRootDMsgHandler.hh:639
Procedure execution status.
Definition: XrdClStatus.hh:110
static const size_t CksumSize
Definition: XrdClXRootDMsgHandler.hh:645
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:659
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:655
Status UnPackReadVResponse(Message *msg)
Unpack a single readv response.
Definition: XrdClXRootDMsgHandler.hh:67
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:666
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:325
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:677
static const size_t PageSize
Definition: XrdClXRootDMsgHandler.hh:644
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:662
static Log * GetLog()
Get default log.
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:672
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:674
Definition: XrdClXRootDResponses.hh:1019
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:683
Definition: XProtocol.hh:485
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1031
virtual uint16_t Examine(Message *msg)
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:668
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:729
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:642
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:675
std::vector< uint32_t > pPgReadCksums
Definition: XrdClXRootDMsgHandler.hh:690
bool pReadVRawMsgDiscard
Definition: XrdClXRootDMsgHandler.hh:698
static const int PageSize
Definition: XrdSysPageSize.hh:36
Message * pResponse
Definition: XrdClXRootDMsgHandler.hh:656
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:648
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:664
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:81
Request status.
Definition: XrdClXRootDResponses.hh:214
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:660
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:705
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:379
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:728
void SetRedirectAsAnswer(bool redirectAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:334
Definition: XProtocol.hh:141
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:673
Definition: XrdSysKernelBuffer.hh:45
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1028
Definition: XProtocol.hh:148
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:638
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:667
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:704
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
Vector read info.
Definition: XrdClXRootDResponses.hh:971
Handle an async response.
Definition: XrdClXRootDResponses.hh:1036
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:409
Definition: XrdClLocalFileHandler.hh:32
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:684
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:351
virtual bool IsRaw() const
Are we a raw writer or not?
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:682
URL representation.
Definition: XrdClURL.hh:30
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:680
bool OmitWait(Message *request, const URL &url)
bool pReadVRawSizeError
Definition: XrdClXRootDMsgHandler.hh:695
Status WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:707
HostList * pHosts
Definition: XrdClXRootDMsgHandler.hh:669
int32_t pReadVRawChunkIndex
Definition: XrdClXRootDMsgHandler.hh:696
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:689
Status pLastError
Definition: XrdClXRootDMsgHandler.hh:665
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:687
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:694
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:671
static PostMaster * GetPostMaster()
Get default post master.
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:111
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:735
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:670
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:658
Definition: XrdClXRootDMsgHandler.hh:62
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:710
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:453
bool pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:720
A network socket.
Definition: XrdClSocket.hh:41
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:343
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:359
Definition: XrdClXRootDMsgHandler.hh:68
readahead_list pReadVRawChunkHeader
Definition: XrdClXRootDMsgHandler.hh:697
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:370