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"
36 
37 #include "XrdSys/XrdSysPthread.hh"
38 #include "XrdSys/XrdSysPageSize.hh"
40 #include "XrdSys/XrdSysPlatform.hh"
41 
43 
44 #include <sys/uio.h>
45 #include <arpa/inet.h> // for network unmarshaling stuff
46 
47 #include <array>
48 #include <list>
49 #include <memory>
50 #include <atomic>
51 #include <memory>
52 
53 namespace XrdCl
54 {
55  class PostMaster;
56  class SIDManager;
57  class URL;
58  class LocalFileHandler;
59  class Socket;
60 
61  //----------------------------------------------------------------------------
62  // Single entry in the redirect-trace-back
63  //----------------------------------------------------------------------------
65  {
66  enum Type
67  {
72  };
73 
74  RedirectEntry( const URL &from, const URL &to, Type type ) :
75  from( from ), to( to ), type( type )
76  {
77 
78  }
79 
84 
85  std::string ToString( bool prevok = true )
86  {
87  const std::string tostr = to.GetLocation();
88  const std::string fromstr = from.GetLocation();
89 
90  if( prevok )
91  {
92  switch( type )
93  {
94  case EntryRedirect: return "Redirected from: " + fromstr + " to: "
95  + tostr;
96 
97  case EntryRedirectOnWait: return "Server responded with wait. "
98  "Falling back to virtual redirector: " + tostr;
99 
100  case EntryRetry: return "Retrying: " + tostr;
101 
102  case EntryWait: return "Waited at server request. Resending: "
103  + tostr;
104  }
105  }
106  return "Failed at: " + fromstr + ", retrying at: " + tostr;
107  }
108  };
109 
110  //----------------------------------------------------------------------------
112  //----------------------------------------------------------------------------
114  {
115  friend class HandleRspJob;
116 
117  public:
118  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
129  ResponseHandler *respHandler,
130  const URL *url,
131  std::shared_ptr<SIDManager> sidMgr,
132  LocalFileHandler *lFileHandler):
133  pRequest( msg ),
134  pResponseHandler( respHandler ),
135  pUrl( *url ),
137  pSidMgr( sidMgr ),
138  pLFileHandler( lFileHandler ),
139  pExpiration( 0 ),
140  pRedirectAsAnswer( false ),
141  pOksofarAsAnswer( false ),
142  pHasLoadBalancer( false ),
143  pHasSessionId( false ),
144  pChunkList( 0 ),
145  pKBuff( 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  pPgWrtCksumBuff( 4 ),
161  pPgWrtCurrentPageNb( 0 ),
162 
163  pReadVRawMsgOffset( 0 ),
164  pReadVRawChunkHeaderDone( false ),
166  pReadVRawSizeError( false ),
167  pReadVRawChunkIndex( 0 ),
168  pReadVRawMsgDiscard( false ),
169 
170  pOtherRawStarted( false ),
171 
172  pFollowMetalink( false ),
173 
174  pStateful( false ),
175 
176  pAggregatedWaitTime( 0 ),
177 
178  pMsgInFly( false ),
179 
180  pTimeoutFence( false ),
181 
182  pDirListStarted( false ),
183  pDirListWithStat( false ),
184 
185  pCV( 0 ),
186 
187  pSslErrCnt( 0 ),
188 
189  pRspStatusBodyUnMarshaled( false ),
191  {
193  if( msg->GetSessionId() )
194  pHasSessionId = true;
195  memset( &pReadVRawChunkHeader, 0, sizeof( readahead_list ) );
196 
197  Log *log = DefaultEnv::GetLog();
198  log->Debug( ExDbgMsg, "[%s] MsgHandler created: 0x%x (message: %s ).",
199  pUrl.GetHostId().c_str(), this,
200  pRequest->GetDescription().c_str() );
201 
203  if( ntohs( hdr->requestid ) == kXR_pgread )
204  {
206  pCrc32cDigests.reserve( XrdOucPgrwUtils::csNum( ntohll( pgrdreq->offset ),
207  ntohl( pgrdreq->rlen ) ) );
208  }
209  }
210 
211  //------------------------------------------------------------------------
213  //------------------------------------------------------------------------
215  {
217 
218  if( !pHasSessionId )
219  delete pRequest;
221 
222  pRequest = reinterpret_cast<Message*>( 0xDEADBEEF );
223  pResponseHandler = reinterpret_cast<ResponseHandler*>( 0xDEADBEEF );
224  pPostMaster = reinterpret_cast<PostMaster*>( 0xDEADBEEF );
225  pLFileHandler = reinterpret_cast<LocalFileHandler*>( 0xDEADBEEF );
226  pChunkList = reinterpret_cast<ChunkList*>( 0xDEADBEEF );
227  pEffectiveDataServerUrl = reinterpret_cast<URL*>( 0xDEADBEEF );
228 
229  Log *log = DefaultEnv::GetLog();
230  log->Debug( ExDbgMsg, "[%s] Destroying MsgHandler: 0x%x.",
231  pUrl.GetHostId().c_str(), this );
232  }
233 
234  //------------------------------------------------------------------------
240  //------------------------------------------------------------------------
241  virtual uint16_t Examine( std::shared_ptr<Message> &msg );
242 
243  //------------------------------------------------------------------------
252  //------------------------------------------------------------------------
253  virtual uint16_t InspectStatusRsp();
254 
255  //------------------------------------------------------------------------
259  //------------------------------------------------------------------------
260  virtual uint16_t GetSid() const;
261 
262  //------------------------------------------------------------------------
266  //------------------------------------------------------------------------
267  virtual void Process();
268 
269  //------------------------------------------------------------------------
279  //------------------------------------------------------------------------
280  virtual XRootDStatus ReadMessageBody( Message *msg,
281  Socket *socket,
282  uint32_t &bytesRead );
283 
284  //------------------------------------------------------------------------
290  //------------------------------------------------------------------------
291  virtual uint8_t OnStreamEvent( StreamEvent event,
292  XRootDStatus status );
293 
294  //------------------------------------------------------------------------
296  //------------------------------------------------------------------------
297  virtual void OnStatusReady( const Message *message,
298  XRootDStatus status );
299 
300  //------------------------------------------------------------------------
302  //------------------------------------------------------------------------
303  virtual bool IsRaw() const;
304 
305  //------------------------------------------------------------------------
314  //------------------------------------------------------------------------
316  uint32_t &bytesWritten );
317 
318  //------------------------------------------------------------------------
322  //------------------------------------------------------------------------
323  void WaitDone( time_t now );
324 
325  //------------------------------------------------------------------------
327  //------------------------------------------------------------------------
328  void SetExpiration( time_t expiration )
329  {
330  pExpiration = expiration;
331  }
332 
333  //------------------------------------------------------------------------
335  //------------------------------------------------------------------------
336  time_t GetExpiration()
337  {
338  return pExpiration;
339  }
340 
341  //------------------------------------------------------------------------
344  //------------------------------------------------------------------------
345  void SetRedirectAsAnswer( bool redirectAsAnswer )
346  {
347  pRedirectAsAnswer = redirectAsAnswer;
348  }
349 
350  //------------------------------------------------------------------------
353  //------------------------------------------------------------------------
354  void SetOksofarAsAnswer( bool oksofarAsAnswer )
355  {
356  pOksofarAsAnswer = oksofarAsAnswer;
357  }
358 
359  //------------------------------------------------------------------------
361  //------------------------------------------------------------------------
362  const Message *GetRequest() const
363  {
364  return pRequest;
365  }
366 
367  //------------------------------------------------------------------------
369  //------------------------------------------------------------------------
370  void SetLoadBalancer( const HostInfo &loadBalancer )
371  {
372  if( !loadBalancer.url.IsValid() )
373  return;
374  pLoadBalancer = loadBalancer;
375  pHasLoadBalancer = true;
376  }
377 
378  //------------------------------------------------------------------------
380  //------------------------------------------------------------------------
381  void SetHostList( HostList *hostList )
382  {
383  pHosts.reset( hostList );
384  }
385 
386  //------------------------------------------------------------------------
388  //------------------------------------------------------------------------
389  void SetChunkList( ChunkList *chunkList )
390  {
391  pChunkList = 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( Message *msg,
442  Socket *socket,
443  uint32_t &bytesRead );
444 
445  //------------------------------------------------------------------------
447  //------------------------------------------------------------------------
449  Socket *socket,
450  uint32_t &bytesRead );
451 
452  //------------------------------------------------------------------------
454  //------------------------------------------------------------------------
456  Socket *socket,
457  uint32_t &bytesRead );
458 
459  //------------------------------------------------------------------------
462  //------------------------------------------------------------------------
463  inline Status ReadAsync( Socket *socket, uint32_t &bytesRead )
464  {
465  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
466  uint32_t btsRead = 0;
467  Status st = ReadBytesAsync( socket, pAsyncReadBuffer, toBeRead, btsRead );
468  pAsyncOffset += btsRead;
469  bytesRead += btsRead;
470  return st;
471  }
472 
473  //------------------------------------------------------------------------
475  //------------------------------------------------------------------------
476  static Status ReadBytesAsync( Socket *socket, char *&buffer,
477  uint32_t toBeRead, uint32_t &bytesRead );
478 
479  //------------------------------------------------------------------------
481  //------------------------------------------------------------------------
482  void HandleError( XRootDStatus status );
483 
484  //------------------------------------------------------------------------
486  //------------------------------------------------------------------------
487  Status RetryAtServer( const URL &url, RedirectEntry::Type entryType );
488 
489  //------------------------------------------------------------------------
491  //------------------------------------------------------------------------
492  void HandleResponse();
493 
494  //------------------------------------------------------------------------
496  //------------------------------------------------------------------------
498 
499  //------------------------------------------------------------------------
502  //------------------------------------------------------------------------
503  Status ParseResponse( AnyObject *&response );
504 
505  //------------------------------------------------------------------------
508  //------------------------------------------------------------------------
509  Status ParseXAttrResponse( char *data, size_t len, AnyObject *&response );
510 
511  //------------------------------------------------------------------------
514  //------------------------------------------------------------------------
515  Status RewriteRequestRedirect( const URL &newUrl );
516 
517  //------------------------------------------------------------------------
519  //------------------------------------------------------------------------
521 
522  //------------------------------------------------------------------------
524  //------------------------------------------------------------------------
525  Status PostProcessReadV( VectorReadInfo *vReadInfo );
526 
527  //------------------------------------------------------------------------
529  //------------------------------------------------------------------------
531 
532  //------------------------------------------------------------------------
534  //------------------------------------------------------------------------
535  void UpdateTriedCGI(uint32_t errNo=0);
536 
537  //------------------------------------------------------------------------
539  //------------------------------------------------------------------------
540  void SwitchOnRefreshFlag();
541 
542  //------------------------------------------------------------------------
545  //------------------------------------------------------------------------
546  void HandleRspOrQueue();
547 
548  //------------------------------------------------------------------------
550  //------------------------------------------------------------------------
551  void HandleLocalRedirect( URL *url );
552 
553  //------------------------------------------------------------------------
558  //------------------------------------------------------------------------
559  bool IsRetriable();
560 
561  //------------------------------------------------------------------------
568  //------------------------------------------------------------------------
569  bool OmitWait( Message &request, const URL &url );
570 
571  //------------------------------------------------------------------------
577  //------------------------------------------------------------------------
578  bool RetriableErrorResponse( const Status &status );
579 
580  //------------------------------------------------------------------------
582  //------------------------------------------------------------------------
583  void DumpRedirectTraceBack();
584 
591  //------------------------------------------------------------------------
592  template<typename T>
593  Status ReadFromBuffer( char *&buffer, size_t &buflen, T& result );
594 
595  //------------------------------------------------------------------------
602  //------------------------------------------------------------------------
603  Status ReadFromBuffer( char *&buffer, size_t &buflen, std::string &result );
604 
605  //------------------------------------------------------------------------
613  //------------------------------------------------------------------------
614  Status ReadFromBuffer( char *&buffer, size_t &buflen, size_t size,
615  std::string &result );
616 
617  //------------------------------------------------------------------------
618  // Helper struct for async reading of chunks
619  //------------------------------------------------------------------------
620  struct ChunkStatus
621  {
622  ChunkStatus(): sizeError( false ), done( false ) {}
623  bool sizeError;
624  bool done;
625  };
626 
627  typedef std::list<std::unique_ptr<RedirectEntry>> RedirectTraceBack;
628 
629  static const size_t CksumSize = sizeof( uint32_t );
630  static const size_t PageWithCksum = XrdSys::PageSize + CksumSize;
631  static const size_t MaxSslErrRetry = 3;
632 
633  inline static size_t NbPgPerRsp( uint64_t offset, uint32_t dlen )
634  {
635  uint32_t pgcnt = 0;
636  uint32_t remainder = offset % XrdSys::PageSize;
637  if( remainder > 0 )
638  {
639  // account for the first unaligned page
640  ++pgcnt;
641  // the size of the 1st unaligned page
642  uint32_t _1stpg = XrdSys::PageSize - remainder;
643  offset += _1stpg;
644  dlen -= _1stpg + CksumSize;
645  }
646  pgcnt += dlen / PageWithCksum;
647  if( dlen % PageWithCksum ) ++ pgcnt;
648  return pgcnt;
649  }
650 
651  inline void Copy( uint32_t offchlst, char *buffer, size_t length )
652  {
653  auto itr = pChunkList->begin();
654  while( length > 0 )
655  {
656  // first find the right buffer
657  char *dstbuf = nullptr;
658  size_t cplen = 0;
659  for( ; itr != pChunkList->end() ; ++itr )
660  {
661  if( offchlst < itr->offset ||
662  offchlst >= itr->offset + itr->length )
663  continue;
664  size_t dstoff = offchlst - itr->offset;
665  dstbuf = reinterpret_cast<char*>( itr->buffer ) + dstoff;
666  cplen = itr->length - cplen;
667  break;
668  }
669  // now do the copy
670  if( cplen > length ) cplen = length;
671  memcpy( dstbuf, buffer, cplen );
672  buffer += cplen;
673  length -= cplen;
674  }
675  }
676 
678  std::shared_ptr<Message> pResponse; //< the ownership is shared with MsgReader
679  std::vector<std::shared_ptr<Message>> pPartialResps; //< the ownership is shared with MsgReader
684  std::shared_ptr<SIDManager> pSidMgr;
688  time_t pExpiration;
691  std::unique_ptr<HostList> pHosts;
695  std::string pRedirectUrl;
697  std::vector<uint32_t> pCrc32cDigests;
699  std::vector<ChunkStatus> pChunkStatus;
702 
703  uint32_t pAsyncOffset;
706  uint32_t pAsyncReadSize;
708  uint32_t pAsyncMsgSize;
709 
712 
713  std::unique_ptr<AsyncPageReader> pPageReader;
714 
718 
726 
728 
730 
731  bool pStateful;
733 
734  std::unique_ptr<RedirectEntry> pRdirEntry;
736 
737  bool pMsgInFly;
738 
739  //------------------------------------------------------------------------
740  // true if MsgHandler is both in inQueue and installed in respective
741  // Stream (this could happen if server gave oksofar response), otherwise
742  // false
743  //------------------------------------------------------------------------
744  std::atomic<bool> pTimeoutFence;
745 
746  //------------------------------------------------------------------------
747  // if we are serving chunked data to the user's handler in case of
748  // kXR_dirlist we need to memorize if the response contains stat info or
749  // not (the information is only encoded in the first chunk)
750  //------------------------------------------------------------------------
753 
754  //------------------------------------------------------------------------
755  // synchronization is needed in case the MsgHandler has been configured
756  // to serve kXR_oksofar as a response to the user's handler
757  //------------------------------------------------------------------------
759 
760  //------------------------------------------------------------------------
761  // Count of consecutive `errTlsSslError` errors
762  //------------------------------------------------------------------------
763  size_t pSslErrCnt;
764 
765  //------------------------------------------------------------------------
766  // Keep track if respective parts of kXR_status response have been
767  // unmarshaled.
768  //------------------------------------------------------------------------
771  };
772 }
773 
774 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:705
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:727
Definition: XrdClAnyObject.hh:32
URL to
Definition: XrdClXRootDMsgHandler.hh:81
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:95
Status ReadRawReadV(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_readv in raw mode.
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:683
virtual bool IsRaw() const
Are we a raw writer or not?
void Copy(uint32_t offchlst, char *buffer, size_t length)
Definition: XrdClXRootDMsgHandler.hh:651
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Definition: XProtocol.hh:653
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
bool pRspStatusBodyUnMarshaled
Definition: XrdClXRootDMsgHandler.hh:769
std::string GetLocation() const
Get location (protocol://host:port/path)
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:622
bool RetriableErrorResponse(const Status &status)
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:710
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:214
std::atomic< bool > pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:744
std::unique_ptr< AsyncPageReader > pPageReader
Definition: XrdClXRootDMsgHandler.hh:713
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:419
Buffer pPgWrtCksumBuff
Definition: XrdClXRootDMsgHandler.hh:715
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:735
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:630
URL from
Definition: XrdClXRootDMsgHandler.hh:80
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:685
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:701
std::string ToString(bool prevok=true)
Definition: XrdClXRootDMsgHandler.hh:85
virtual uint16_t Examine(std::shared_ptr< Message > &msg)
std::shared_ptr< Message > pResponse
Definition: XrdClXRootDMsgHandler.hh:678
Message handler.
Definition: XrdClPostMasterInterfaces.hh:50
virtual XRootDStatus ReadMessageBody(Message *msg, Socket *socket, uint32_t &bytesRead)
std::vector< ChunkStatus > pChunkStatus
Definition: XrdClXRootDMsgHandler.hh:699
kXR_unt16 requestid
Definition: XProtocol.hh:157
Definition: XrdClXRootDMsgHandler.hh:620
XRootDMsgHandler(Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler)
Definition: XrdClXRootDMsgHandler.hh:128
kXR_int32 rlen
Definition: XProtocol.hh:506
uint32_t pReadVRawMsgOffset
Definition: XrdClXRootDMsgHandler.hh:719
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:115
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.
bool pReadVRawChunkHeaderDone
Definition: XrdClXRootDMsgHandler.hh:720
Status ParseResponse(AnyObject *&response)
virtual uint16_t GetSid() const
static size_t NbPgPerRsp(uint64_t offset, uint32_t dlen)
Definition: XrdClXRootDMsgHandler.hh:633
bool pFollowMetalink
Definition: XrdClXRootDMsgHandler.hh:729
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
bool done
Definition: XrdClXRootDMsgHandler.hh:624
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:629
Status RewriteRequestRedirect(const URL &newUrl)
Status UnPackReadVResponse(Message &msg)
Unpack a single readv response.
URL pUrl
Definition: XrdClXRootDMsgHandler.hh:681
StreamEvent
Events that may have occurred to the stream.
Definition: XrdClPostMasterInterfaces.hh:78
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:677
Definition: XrdClXRootDMsgHandler.hh:69
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:688
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:328
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:700
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:684
static Log * GetLog()
Get default log.
XRootDStatus WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:694
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:696
Definition: XrdClXRootDResponses.hh:1099
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:707
bool pRspPgWrtRetrnsmReqUnMarshalled
Definition: XrdClXRootDMsgHandler.hh:770
Definition: XProtocol.hh:501
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1111
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:690
static const size_t MaxSslErrRetry
Definition: XrdClXRootDMsgHandler.hh:631
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:752
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:627
Definition: XrdSysPthread.hh:78
XrdSys::KernelBuffer * pKBuff
Definition: XrdClXRootDMsgHandler.hh:698
bool pReadVRawMsgDiscard
Definition: XrdClXRootDMsgHandler.hh:725
static const int PageSize
Definition: XrdSysPageSize.hh:36
RedirectEntry(const URL &from, const URL &to, Type type)
Definition: XrdClXRootDMsgHandler.hh:74
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:686
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:83
Request status.
Definition: XrdClXRootDResponses.hh:218
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:682
Status PostProcessReadV(VectorReadInfo *vReadInfo)
Post process vector read.
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
Definition: XrdClURL.hh:94
Type type
Definition: XrdClXRootDMsgHandler.hh:82
int pAggregatedWaitTime
Definition: XrdClXRootDMsgHandler.hh:732
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:389
virtual void Process()
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:751
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:345
Definition: XProtocol.hh:142
std::unique_ptr< HostList > pHosts
Definition: XrdClXRootDMsgHandler.hh:691
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:695
Definition: XrdSysKernelBuffer.hh:45
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1108
uint32_t pPgWrtCurrentPageNb
Definition: XrdClXRootDMsgHandler.hh:717
Definition: XProtocol.hh:155
bool OmitWait(Message &request, const URL &url)
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:623
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:689
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:731
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
Vector read info.
Definition: XrdClXRootDResponses.hh:1051
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:362
Handle an async response.
Definition: XrdClXRootDResponses.hh:1116
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:424
uint32_t pPgWrtCurrentPageOffset
Definition: XrdClXRootDMsgHandler.hh:716
Definition: XrdClLocalFileHandler.hh:32
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:708
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:706
URL representation.
Definition: XrdClURL.hh:30
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:703
bool pReadVRawSizeError
Definition: XrdClXRootDMsgHandler.hh:722
std::vector< std::shared_ptr< Message > > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:679
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:734
int32_t pReadVRawChunkIndex
Definition: XrdClXRootDMsgHandler.hh:723
Definition: XrdClXRootDMsgHandler.hh:68
kXR_int64 offset
Definition: XProtocol.hh:505
void WaitDone(time_t now)
size_t pSslErrCnt
Definition: XrdClXRootDMsgHandler.hh:763
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:687
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:711
time_t GetExpiration()
Get a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:336
Definition: XrdClXRootDMsgHandler.hh:71
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:47
Type
Definition: XrdClXRootDMsgHandler.hh:66
bool pReadVRawChunkHeaderStarted
Definition: XrdClXRootDMsgHandler.hh:721
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:693
static PostMaster * GetPostMaster()
Get default post master.
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:113
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:758
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:692
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:680
Definition: XrdClXRootDMsgHandler.hh:64
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:697
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:737
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:463
A network socket.
Definition: XrdClSocket.hh:42
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:354
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:370
Binary blob representation.
Definition: XrdClBuffer.hh:33
uint32_t pAsyncChunkOffset
Definition: XrdClXRootDMsgHandler.hh:704
Definition: XrdClXRootDMsgHandler.hh:70
readahead_list pReadVRawChunkHeader
Definition: XrdClXRootDMsgHandler.hh:724
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:381