xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
37 
38 #include "XrdSys/XrdSysPthread.hh"
39 #include "XrdSys/XrdSysPageSize.hh"
41 #include "XrdSys/XrdSysPlatform.hh"
42 
44 
45 #include <sys/uio.h>
46 #include <arpa/inet.h> // for network unmarshaling stuff
47 
48 #include <array>
49 #include <list>
50 #include <memory>
51 #include <atomic>
52 #include <memory>
53 
54 namespace XrdCl
55 {
56  class PostMaster;
57  class SIDManager;
58  class URL;
59  class LocalFileHandler;
60  class Socket;
61 
62  //----------------------------------------------------------------------------
63  // Single entry in the redirect-trace-back
64  //----------------------------------------------------------------------------
66  {
67  enum Type
68  {
73  };
74 
75  RedirectEntry( const URL &from, const URL &to, Type type ) :
76  from( from ), to( to ), type( type )
77  {
78 
79  }
80 
85 
86  std::string ToString( bool prevok = true )
87  {
88  const std::string tostr = to.GetLocation();
89  const std::string fromstr = from.GetLocation();
90 
91  if( prevok )
92  {
93  switch( type )
94  {
95  case EntryRedirect: return "Redirected from: " + fromstr + " to: "
96  + tostr;
97 
98  case EntryRedirectOnWait: return "Server responded with wait. "
99  "Falling back to virtual redirector: " + tostr;
100 
101  case EntryRetry: return "Retrying: " + tostr;
102 
103  case EntryWait: return "Waited at server request. Resending: "
104  + tostr;
105  }
106  }
107  return "Failed at: " + fromstr + ", retrying at: " + tostr;
108  }
109  };
110 
111  //----------------------------------------------------------------------------
113  //----------------------------------------------------------------------------
115  {
116  friend class HandleRspJob;
117 
118  public:
119  //------------------------------------------------------------------------
128  //------------------------------------------------------------------------
130  ResponseHandler *respHandler,
131  const URL *url,
132  std::shared_ptr<SIDManager> sidMgr,
133  LocalFileHandler *lFileHandler):
134  pRequest( msg ),
135  pResponseHandler( respHandler ),
136  pUrl( *url ),
138  pSidMgr( sidMgr ),
139  pLFileHandler( lFileHandler ),
140  pExpiration( 0 ),
141  pRedirectAsAnswer( false ),
142  pOksofarAsAnswer( false ),
143  pHasLoadBalancer( false ),
144  pHasSessionId( false ),
145  pChunkList( 0 ),
146  pKBuff( 0 ),
147  pRedirectCounter( 0 ),
149 
150  pAsyncOffset( 0 ),
151  pAsyncChunkOffset( 0 ),
152  pAsyncChunkIndex( 0 ),
153  pAsyncReadSize( 0 ),
154  pAsyncReadBuffer( 0 ),
155  pAsyncMsgSize( 0 ),
156 
157  pReadRawStarted( false ),
159 
160  pPgWrtCksumBuff( 4 ),
162  pPgWrtCurrentPageNb( 0 ),
163 
164  pOtherRawStarted( false ),
165 
166  pFollowMetalink( false ),
167 
168  pStateful( false ),
169 
170  pAggregatedWaitTime( 0 ),
171 
172  pMsgInFly( false ),
173 
174  pTimeoutFence( false ),
175 
176  pDirListStarted( false ),
177  pDirListWithStat( false ),
178 
179  pCV( 0 ),
180 
181  pSslErrCnt( 0 ),
182 
183  pRspStatusBodyUnMarshaled( false ),
185  {
187  if( msg->GetSessionId() )
188  pHasSessionId = true;
189 
190  Log *log = DefaultEnv::GetLog();
191  log->Debug( ExDbgMsg, "[%s] MsgHandler created: 0x%x (message: %s ).",
192  pUrl.GetHostId().c_str(), this,
193  pRequest->GetDescription().c_str() );
194 
196  if( ntohs( hdr->requestid ) == kXR_pgread )
197  {
199  pCrc32cDigests.reserve( XrdOucPgrwUtils::csNum( ntohll( pgrdreq->offset ),
200  ntohl( pgrdreq->rlen ) ) );
201  }
202 
203  if( ntohs( hdr->requestid ) == kXR_readv )
204  {
205  pVectorReader.reset( new AsyncVectorReader( *url ) );
206  }
207  }
208 
209  //------------------------------------------------------------------------
211  //------------------------------------------------------------------------
213  {
215 
216  if( !pHasSessionId )
217  delete pRequest;
219 
220  pRequest = reinterpret_cast<Message*>( 0xDEADBEEF );
221  pResponseHandler = reinterpret_cast<ResponseHandler*>( 0xDEADBEEF );
222  pPostMaster = reinterpret_cast<PostMaster*>( 0xDEADBEEF );
223  pLFileHandler = reinterpret_cast<LocalFileHandler*>( 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( std::shared_ptr<Message> &msg );
240 
241  //------------------------------------------------------------------------
250  //------------------------------------------------------------------------
251  virtual uint16_t InspectStatusRsp();
252 
253  //------------------------------------------------------------------------
257  //------------------------------------------------------------------------
258  virtual uint16_t GetSid() const;
259 
260  //------------------------------------------------------------------------
264  //------------------------------------------------------------------------
265  virtual void Process();
266 
267  //------------------------------------------------------------------------
277  //------------------------------------------------------------------------
278  virtual XRootDStatus 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  //------------------------------------------------------------------------
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  //------------------------------------------------------------------------
333  //------------------------------------------------------------------------
334  time_t GetExpiration()
335  {
336  return pExpiration;
337  }
338 
339  //------------------------------------------------------------------------
342  //------------------------------------------------------------------------
343  void SetRedirectAsAnswer( bool redirectAsAnswer )
344  {
345  pRedirectAsAnswer = redirectAsAnswer;
346  }
347 
348  //------------------------------------------------------------------------
351  //------------------------------------------------------------------------
352  void SetOksofarAsAnswer( bool oksofarAsAnswer )
353  {
354  pOksofarAsAnswer = oksofarAsAnswer;
355  }
356 
357  //------------------------------------------------------------------------
359  //------------------------------------------------------------------------
360  const Message *GetRequest() const
361  {
362  return pRequest;
363  }
364 
365  //------------------------------------------------------------------------
367  //------------------------------------------------------------------------
368  void SetLoadBalancer( const HostInfo &loadBalancer )
369  {
370  if( !loadBalancer.url.IsValid() )
371  return;
372  pLoadBalancer = loadBalancer;
373  pHasLoadBalancer = true;
374  }
375 
376  //------------------------------------------------------------------------
378  //------------------------------------------------------------------------
379  void SetHostList( HostList *hostList )
380  {
381  pHosts.reset( hostList );
382  }
383 
384  //------------------------------------------------------------------------
386  //------------------------------------------------------------------------
387  void SetChunkList( ChunkList *chunkList )
388  {
389  pChunkList = chunkList;
390  if( pVectorReader )
391  pVectorReader->SetChunkList( chunkList );
392  if( chunkList )
393  pChunkStatus.resize( chunkList->size() );
394  else
395  pChunkStatus.clear();
396  }
397 
398  void SetCrc32cDigests( std::vector<uint32_t> && crc32cDigests )
399  {
400  pCrc32cDigests = std::move( crc32cDigests );
401  }
402 
403  //------------------------------------------------------------------------
405  //------------------------------------------------------------------------
407  {
408  pKBuff = kbuff;
409  }
410 
411  //------------------------------------------------------------------------
413  //------------------------------------------------------------------------
414  void SetRedirectCounter( uint16_t redirectCounter )
415  {
416  pRedirectCounter = redirectCounter;
417  }
418 
419  void SetFollowMetalink( bool followMetalink )
420  {
421  pFollowMetalink = followMetalink;
422  }
423 
424  void SetStateful( bool stateful )
425  {
426  pStateful = stateful;
427  }
428 
429  //------------------------------------------------------------------------
433  //------------------------------------------------------------------------
434  void PartialReceived();
435 
436  private:
437 
438  //------------------------------------------------------------------------
440  //------------------------------------------------------------------------
441  Status ReadRawRead( Socket *socket,
442  uint32_t &bytesRead );
443 
444  //------------------------------------------------------------------------
446  //------------------------------------------------------------------------
447  Status ReadRawOther( 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  //------------------------------------------------------------------------
466  //------------------------------------------------------------------------
467  static Status ReadBytesAsync( Socket *socket, char *&buffer,
468  uint32_t toBeRead, uint32_t &bytesRead );
469 
470  //------------------------------------------------------------------------
472  //------------------------------------------------------------------------
473  void HandleError( XRootDStatus status );
474 
475  //------------------------------------------------------------------------
477  //------------------------------------------------------------------------
478  Status RetryAtServer( const URL &url, RedirectEntry::Type entryType );
479 
480  //------------------------------------------------------------------------
482  //------------------------------------------------------------------------
483  void HandleResponse();
484 
485  //------------------------------------------------------------------------
487  //------------------------------------------------------------------------
489 
490  //------------------------------------------------------------------------
493  //------------------------------------------------------------------------
494  Status ParseResponse( AnyObject *&response );
495 
496  //------------------------------------------------------------------------
499  //------------------------------------------------------------------------
500  Status ParseXAttrResponse( char *data, size_t len, AnyObject *&response );
501 
502  //------------------------------------------------------------------------
505  //------------------------------------------------------------------------
506  Status RewriteRequestRedirect( const URL &newUrl );
507 
508  //------------------------------------------------------------------------
510  //------------------------------------------------------------------------
512 
513  //------------------------------------------------------------------------
515  //------------------------------------------------------------------------
516  void UpdateTriedCGI(uint32_t errNo=0);
517 
518  //------------------------------------------------------------------------
520  //------------------------------------------------------------------------
521  void SwitchOnRefreshFlag();
522 
523  //------------------------------------------------------------------------
526  //------------------------------------------------------------------------
527  void HandleRspOrQueue();
528 
529  //------------------------------------------------------------------------
531  //------------------------------------------------------------------------
532  void HandleLocalRedirect( URL *url );
533 
534  //------------------------------------------------------------------------
539  //------------------------------------------------------------------------
540  bool IsRetriable();
541 
542  //------------------------------------------------------------------------
549  //------------------------------------------------------------------------
550  bool OmitWait( Message &request, const URL &url );
551 
552  //------------------------------------------------------------------------
558  //------------------------------------------------------------------------
559  bool RetriableErrorResponse( const Status &status );
560 
561  //------------------------------------------------------------------------
563  //------------------------------------------------------------------------
564  void DumpRedirectTraceBack();
565 
572  //------------------------------------------------------------------------
573  template<typename T>
574  Status ReadFromBuffer( char *&buffer, size_t &buflen, T& result );
575 
576  //------------------------------------------------------------------------
583  //------------------------------------------------------------------------
584  Status ReadFromBuffer( char *&buffer, size_t &buflen, std::string &result );
585 
586  //------------------------------------------------------------------------
594  //------------------------------------------------------------------------
595  Status ReadFromBuffer( char *&buffer, size_t &buflen, size_t size,
596  std::string &result );
597 
598  //------------------------------------------------------------------------
599  // Helper struct for async reading of chunks
600  //------------------------------------------------------------------------
601  struct ChunkStatus
602  {
603  ChunkStatus(): sizeError( false ), done( false ) {}
604  bool sizeError;
605  bool done;
606  };
607 
608  typedef std::list<std::unique_ptr<RedirectEntry>> RedirectTraceBack;
609 
610  static const size_t CksumSize = sizeof( uint32_t );
611  static const size_t PageWithCksum = XrdSys::PageSize + CksumSize;
612  static const size_t MaxSslErrRetry = 3;
613 
614  inline static size_t NbPgPerRsp( uint64_t offset, uint32_t dlen )
615  {
616  uint32_t pgcnt = 0;
617  uint32_t remainder = offset % XrdSys::PageSize;
618  if( remainder > 0 )
619  {
620  // account for the first unaligned page
621  ++pgcnt;
622  // the size of the 1st unaligned page
623  uint32_t _1stpg = XrdSys::PageSize - remainder;
624  offset += _1stpg;
625  dlen -= _1stpg + CksumSize;
626  }
627  pgcnt += dlen / PageWithCksum;
628  if( dlen % PageWithCksum ) ++ pgcnt;
629  return pgcnt;
630  }
631 
633  std::shared_ptr<Message> pResponse; //< the ownership is shared with MsgReader
634  std::vector<std::shared_ptr<Message>> pPartialResps; //< the ownership is shared with MsgReader
639  std::shared_ptr<SIDManager> pSidMgr;
643  time_t pExpiration;
646  std::unique_ptr<HostList> pHosts;
650  std::string pRedirectUrl;
652  std::vector<uint32_t> pCrc32cDigests;
654  std::vector<ChunkStatus> pChunkStatus;
657 
658  uint32_t pAsyncOffset;
661  uint32_t pAsyncReadSize;
663  uint32_t pAsyncMsgSize;
664 
667 
668  std::unique_ptr<AsyncPageReader> pPageReader;
669  std::unique_ptr<AsyncVectorReader> pVectorReader;
670 
674 
676 
678 
679  bool pStateful;
681 
682  std::unique_ptr<RedirectEntry> pRdirEntry;
684 
685  bool pMsgInFly;
686 
687  //------------------------------------------------------------------------
688  // true if MsgHandler is both in inQueue and installed in respective
689  // Stream (this could happen if server gave oksofar response), otherwise
690  // false
691  //------------------------------------------------------------------------
692  std::atomic<bool> pTimeoutFence;
693 
694  //------------------------------------------------------------------------
695  // if we are serving chunked data to the user's handler in case of
696  // kXR_dirlist we need to memorize if the response contains stat info or
697  // not (the information is only encoded in the first chunk)
698  //------------------------------------------------------------------------
701 
702  //------------------------------------------------------------------------
703  // synchronization is needed in case the MsgHandler has been configured
704  // to serve kXR_oksofar as a response to the user's handler
705  //------------------------------------------------------------------------
707 
708  //------------------------------------------------------------------------
709  // Count of consecutive `errTlsSslError` errors
710  //------------------------------------------------------------------------
711  size_t pSslErrCnt;
712 
713  //------------------------------------------------------------------------
714  // Keep track if respective parts of kXR_status response have been
715  // unmarshaled.
716  //------------------------------------------------------------------------
719  };
720 }
721 
722 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:660
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:675
Definition: XrdClAnyObject.hh:32
URL to
Definition: XrdClXRootDMsgHandler.hh:82
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:95
void UpdateTriedCGI(uint32_t errNo=0)
Update the &quot;tried=&quot; part of the CGI of the current message.
const uint64_t ExDbgMsg
Definition: XrdClConstants.hh:44
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:1046
Status RetryAtServer(const URL &url, RedirectEntry::Type entryType)
Retry the request at another server.
PostMaster * pPostMaster
Definition: XrdClXRootDMsgHandler.hh:638
virtual bool IsRaw() const
Are we a raw writer or not?
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Status ReadRawRead(Socket *socket, uint32_t &bytesRead)
Handle a kXR_read in raw mode.
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
bool pRspStatusBodyUnMarshaled
Definition: XrdClXRootDMsgHandler.hh:717
std::string GetLocation() const
Get location (protocol://host:port/path)
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:603
bool RetriableErrorResponse(const Status &status)
Status ReadRawOther(Socket *socket, uint32_t &bytesRead)
Handle anything other than kXR_read and kXR_readv in raw mode.
bool IsValid() const
Is the url valid.
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
Definition: XrdClXRootDMsgHandler.hh:414
bool pReadRawStarted
Definition: XrdClXRootDMsgHandler.hh:665
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:212
std::atomic< bool > pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:692
std::unique_ptr< AsyncPageReader > pPageReader
Definition: XrdClXRootDMsgHandler.hh:668
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:419
Buffer pPgWrtCksumBuff
Definition: XrdClXRootDMsgHandler.hh:671
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:683
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:611
URL from
Definition: XrdClXRootDMsgHandler.hh:81
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:640
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:656
std::string ToString(bool prevok=true)
Definition: XrdClXRootDMsgHandler.hh:86
virtual uint16_t Examine(std::shared_ptr< Message > &msg)
std::shared_ptr< Message > pResponse
Definition: XrdClXRootDMsgHandler.hh:633
Message handler.
Definition: XrdClPostMasterInterfaces.hh:50
virtual XRootDStatus ReadMessageBody(Message *msg, Socket *socket, uint32_t &bytesRead)
std::vector< ChunkStatus > pChunkStatus
Definition: XrdClXRootDMsgHandler.hh:654
kXR_unt16 requestid
Definition: XProtocol.hh:157
Definition: XrdClXRootDMsgHandler.hh:601
XRootDMsgHandler(Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler)
Definition: XrdClXRootDMsgHandler.hh:129
kXR_int32 rlen
Definition: XProtocol.hh:506
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:116
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
Definition: XrdClXRootDMsgHandler.hh:406
static Status ReadBytesAsync(Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead)
Read a buffer asynchronously.
Status ParseResponse(AnyObject *&response)
virtual uint16_t GetSid() const
static size_t NbPgPerRsp(uint64_t offset, uint32_t dlen)
Definition: XrdClXRootDMsgHandler.hh:614
bool pFollowMetalink
Definition: XrdClXRootDMsgHandler.hh:677
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
bool done
Definition: XrdClXRootDMsgHandler.hh:605
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
Definition: XrdClBuffer.hh:72
Procedure execution status.
Definition: XrdClStatus.hh:113
static const size_t CksumSize
Definition: XrdClXRootDMsgHandler.hh:610
Status RewriteRequestRedirect(const URL &newUrl)
URL pUrl
Definition: XrdClXRootDMsgHandler.hh:636
StreamEvent
Events that may have occurred to the stream.
Definition: XrdClPostMasterInterfaces.hh:78
virtual void OnStatusReady(const Message *message, XRootDStatus status)
The requested action has been performed and the status is available.
Message * pRequest
Definition: XrdClXRootDMsgHandler.hh:632
Definition: XrdClXRootDMsgHandler.hh:70
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:643
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:326
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:655
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:639
static Log * GetLog()
Get default log.
XRootDStatus WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:649
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:651
Definition: XrdClXRootDResponses.hh:1099
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:662
bool pRspPgWrtRetrnsmReqUnMarshalled
Definition: XrdClXRootDMsgHandler.hh:718
Definition: XProtocol.hh:501
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1111
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:645
static const size_t MaxSslErrRetry
Definition: XrdClXRootDMsgHandler.hh:612
bool pDirListWithStat
Definition: XrdClXRootDMsgHandler.hh:700
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:608
Definition: XrdSysPthread.hh:78
XrdSys::KernelBuffer * pKBuff
Definition: XrdClXRootDMsgHandler.hh:653
Object for reading out data from the VectorRead response.
Definition: XrdClAsyncVectorReader.hh:32
static const int PageSize
Definition: XrdSysPageSize.hh:36
RedirectEntry(const URL &from, const URL &to, Type type)
Definition: XrdClXRootDMsgHandler.hh:75
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:641
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:84
Request status.
Definition: XrdClXRootDResponses.hh:218
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:637
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
Definition: XrdClURL.hh:94
Type type
Definition: XrdClXRootDMsgHandler.hh:83
int pAggregatedWaitTime
Definition: XrdClXRootDMsgHandler.hh:680
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:387
virtual void Process()
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:699
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition: XrdClMessage.hh:111
virtual uint16_t InspectStatusRsp()
void SetRedirectAsAnswer(bool redirectAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:343
Definition: XProtocol.hh:142
std::unique_ptr< HostList > pHosts
Definition: XrdClXRootDMsgHandler.hh:646
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:650
Definition: XrdSysKernelBuffer.hh:45
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1108
uint32_t pPgWrtCurrentPageNb
Definition: XrdClXRootDMsgHandler.hh:673
Definition: XProtocol.hh:155
bool OmitWait(Message &request, const URL &url)
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:604
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:644
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:679
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:360
Handle an async response.
Definition: XrdClXRootDResponses.hh:1116
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:424
uint32_t pPgWrtCurrentPageOffset
Definition: XrdClXRootDMsgHandler.hh:672
Definition: XrdClLocalFileHandler.hh:32
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:663
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:661
URL representation.
Definition: XrdClURL.hh:30
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:658
std::vector< std::shared_ptr< Message > > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:634
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:682
Definition: XrdClXRootDMsgHandler.hh:69
kXR_int64 offset
Definition: XProtocol.hh:505
std::unique_ptr< AsyncVectorReader > pVectorReader
Definition: XrdClXRootDMsgHandler.hh:669
void WaitDone(time_t now)
size_t pSslErrCnt
Definition: XrdClXRootDMsgHandler.hh:711
virtual uint8_t OnStreamEvent(StreamEvent event, XRootDStatus status)
XRootDStatus * ProcessStatus()
Extract the status information from the stuff that we got.
Status pLastError
Definition: XrdClXRootDMsgHandler.hh:642
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:666
time_t GetExpiration()
Get a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:334
Definition: XrdClXRootDMsgHandler.hh:72
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:47
Type
Definition: XrdClXRootDMsgHandler.hh:67
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:648
static PostMaster * GetPostMaster()
Get default post master.
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:114
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:706
void HandleError(XRootDStatus status)
Recover error.
void Debug(uint64_t topic, const char *format,...)
Print a debug message.
void SetCrc32cDigests(std::vector< uint32_t > &&crc32cDigests)
Definition: XrdClXRootDMsgHandler.hh:398
void HandleResponse()
Unpack the message and call the response handler.
bool pHasLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:647
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:635
Definition: XrdClXRootDMsgHandler.hh:65
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset &amp; length.
std::vector< uint32_t > pCrc32cDigests
Definition: XrdClXRootDMsgHandler.hh:652
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:685
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:454
A network socket.
Definition: XrdClSocket.hh:42
Definition: XProtocol.hh:137
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:352
void DumpRedirectTraceBack()
Dump the redirect-trace-back into the log file.
Handle diagnostics.
Definition: XrdClLog.hh:100
void SetLoadBalancer(const HostInfo &loadBalancer)
Set the load balancer.
Definition: XrdClXRootDMsgHandler.hh:368
Binary blob representation.
Definition: XrdClBuffer.hh:33
uint32_t pAsyncChunkOffset
Definition: XrdClXRootDMsgHandler.hh:659
Definition: XrdClXRootDMsgHandler.hh:71
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:379