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 #include <atomic>
48 
49 namespace XrdCl
50 {
51  class PostMaster;
52  class SIDManager;
53  class URL;
54  class LocalFileHandler;
55  class Socket;
56 
57  //----------------------------------------------------------------------------
58  // Single entry in the redirect-trace-back
59  //----------------------------------------------------------------------------
61  {
62  enum Type
63  {
68  };
69 
70  RedirectEntry( const URL &from, const URL &to, Type type ) :
71  from( from ), to( to ), type( type )
72  {
73 
74  }
75 
80 
81  std::string ToString( bool prevok = true )
82  {
83  const std::string tostr = to.GetLocation();
84  const std::string fromstr = from.GetLocation();
85 
86  if( prevok )
87  {
88  switch( type )
89  {
90  case EntryRedirect: return "Redirected from: " + fromstr + " to: "
91  + tostr;
92 
93  case EntryRedirectOnWait: return "Server responded with wait. "
94  "Falling back to virtual redirector: " + tostr;
95 
96  case EntryRetry: return "Retrying: " + tostr;
97 
98  case EntryWait: return "Waited at server request. Resending: "
99  + tostr;
100  }
101  }
102  return "Failed at: " + fromstr + ", retrying at: " + tostr;
103  }
104  };
105 
106  //----------------------------------------------------------------------------
108  //----------------------------------------------------------------------------
110  {
111  friend class HandleRspJob;
112 
113  public:
114  //------------------------------------------------------------------------
123  //------------------------------------------------------------------------
125  ResponseHandler *respHandler,
126  const URL *url,
127  std::shared_ptr<SIDManager> sidMgr,
128  LocalFileHandler *lFileHandler):
129  pRequest( msg ),
130  pResponse( 0 ),
131  pResponseHandler( respHandler ),
132  pUrl( *url ),
134  pSidMgr( sidMgr ),
135  pLFileHandler( lFileHandler ),
136  pExpiration( 0 ),
137  pRedirectAsAnswer( false ),
138  pOksofarAsAnswer( false ),
139  pHosts( 0 ),
140  pHasLoadBalancer( false ),
141  pHasSessionId( false ),
142  pChunkList( 0 ),
143  pRedirectCounter( 0 ),
145 
146  pAsyncOffset( 0 ),
147  pAsyncChunkOffset( 0 ),
148  pAsyncChunkIndex( 0 ),
149  pAsyncReadSize( 0 ),
150  pAsyncReadBuffer( 0 ),
151  pAsyncMsgSize( 0 ),
152 
153  pReadRawStarted( false ),
155 
156  pReadVRawMsgOffset( 0 ),
157  pReadVRawChunkHeaderDone( false ),
159  pReadVRawSizeError( false ),
160  pReadVRawChunkIndex( 0 ),
161  pReadVRawMsgDiscard( false ),
162 
163  pOtherRawStarted( false ),
164 
165  pFollowMetalink( false ),
166 
167  pStateful( false ),
168 
169  pAggregatedWaitTime( 0 ),
170 
171  pMsgInFly( false ),
172 
173  pTimeoutFence( false ),
174 
175  pDirListStarted( false ),
176  pDirListWithStat( false ),
177 
178  pCV( 0 ),
179 
180  pSslErrCnt( 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 XRootDStatus 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  //------------------------------------------------------------------------
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  //------------------------------------------------------------------------
332  //------------------------------------------------------------------------
333  time_t GetExpiration()
334  {
335  return pExpiration;
336  }
337 
338  //------------------------------------------------------------------------
341  //------------------------------------------------------------------------
342  void SetRedirectAsAnswer( bool redirectAsAnswer )
343  {
344  pRedirectAsAnswer = redirectAsAnswer;
345  }
346 
347  //------------------------------------------------------------------------
350  //------------------------------------------------------------------------
351  void SetOksofarAsAnswer( bool oksofarAsAnswer )
352  {
353  pOksofarAsAnswer = oksofarAsAnswer;
354  }
355 
356  //------------------------------------------------------------------------
358  //------------------------------------------------------------------------
359  const Message *GetRequest() const
360  {
361  return pRequest;
362  }
363 
364  //------------------------------------------------------------------------
366  //------------------------------------------------------------------------
367  void SetLoadBalancer( const HostInfo &loadBalancer )
368  {
369  if( !loadBalancer.url.IsValid() )
370  return;
371  pLoadBalancer = loadBalancer;
372  pHasLoadBalancer = true;
373  }
374 
375  //------------------------------------------------------------------------
377  //------------------------------------------------------------------------
378  void SetHostList( HostList *hostList )
379  {
380  delete pHosts;
381  pHosts = hostList;
382  }
383 
384  //------------------------------------------------------------------------
386  //------------------------------------------------------------------------
387  void SetChunkList( ChunkList *chunkList )
388  {
389  pChunkList = chunkList;
390  if( chunkList )
391  pChunkStatus.resize( chunkList->size() );
392  else
393  pChunkStatus.clear();
394  }
395 
396  //------------------------------------------------------------------------
398  //------------------------------------------------------------------------
400  {
401  pKBuff = kbuff;
402  }
403 
404  //------------------------------------------------------------------------
406  //------------------------------------------------------------------------
407  void SetRedirectCounter( uint16_t redirectCounter )
408  {
409  pRedirectCounter = redirectCounter;
410  }
411 
412  void SetFollowMetalink( bool followMetalink )
413  {
414  pFollowMetalink = followMetalink;
415  }
416 
417  void SetStateful( bool stateful )
418  {
419  pStateful = stateful;
420  }
421 
422  //------------------------------------------------------------------------
424  //------------------------------------------------------------------------
425  void TakeDownTimeoutFence();
426 
427  private:
428 
429  //------------------------------------------------------------------------
431  //------------------------------------------------------------------------
432  Status ReadRawRead( Message *msg,
433  Socket *socket,
434  uint32_t &bytesRead );
435 
436  //------------------------------------------------------------------------
438  //------------------------------------------------------------------------
440  Socket *socket,
441  uint32_t &bytesRead );
442 
443  //------------------------------------------------------------------------
445  //------------------------------------------------------------------------
447  Socket *socket,
448  uint32_t &bytesRead );
449 
450  //------------------------------------------------------------------------
452  //------------------------------------------------------------------------
454  Socket *socket,
455  uint32_t &bytesRead );
456 
457  //------------------------------------------------------------------------
460  //------------------------------------------------------------------------
461  inline Status ReadAsync( Socket *socket, uint32_t &bytesRead )
462  {
463  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
464  uint32_t btsRead = 0;
465  Status st = ReadBytesAsync( socket, pAsyncReadBuffer, toBeRead, btsRead );
466  pAsyncOffset += btsRead;
467  bytesRead += btsRead;
468  return st;
469  }
470 
471  //------------------------------------------------------------------------
474  //------------------------------------------------------------------------
475  inline Status ReadPagesAsync( Socket *socket, uint32_t &bytesRead )
476  {
477  uint32_t toBeRead = pAsyncReadSize - pAsyncOffset;
478  while( toBeRead > 0 )
479  {
480  uint32_t btsRead = 0;
481  Status st = ReadPageAsync( socket, btsRead );
482  if( !st.IsOK() || st.code == suRetry ) return st;
483  bytesRead += btsRead;
484  toBeRead -= btsRead;
485  }
486 
487  return Status();
488  }
489 
490  //------------------------------------------------------------------------
493  //------------------------------------------------------------------------
494  Status ReadPageAsync( Socket *socket, uint32_t &bytesRead );
495 
496  //------------------------------------------------------------------------
498  //------------------------------------------------------------------------
499  static Status ReadBytesAsync( Socket *socket, char *&buffer,
500  uint32_t toBeRead, uint32_t &bytesRead );
501 
502  //------------------------------------------------------------------------
504  //------------------------------------------------------------------------
505  void HandleError( XRootDStatus status, Message *msg = 0 );
506 
507  //------------------------------------------------------------------------
509  //------------------------------------------------------------------------
510  Status RetryAtServer( const URL &url, RedirectEntry::Type entryType );
511 
512  //------------------------------------------------------------------------
514  //------------------------------------------------------------------------
515  void HandleResponse();
516 
517  //------------------------------------------------------------------------
519  //------------------------------------------------------------------------
521 
522  //------------------------------------------------------------------------
525  //------------------------------------------------------------------------
526  Status ParseResponse( AnyObject *&response );
527 
528  //------------------------------------------------------------------------
531  //------------------------------------------------------------------------
532  Status ParseXAttrResponse( char *data, size_t len, AnyObject *&response );
533 
534  //------------------------------------------------------------------------
537  //------------------------------------------------------------------------
538  Status RewriteRequestRedirect( const URL &newUrl );
539 
540  //------------------------------------------------------------------------
542  //------------------------------------------------------------------------
544 
545  //------------------------------------------------------------------------
547  //------------------------------------------------------------------------
548  Status PostProcessReadV( VectorReadInfo *vReadInfo );
549 
550  //------------------------------------------------------------------------
552  //------------------------------------------------------------------------
554 
555  //------------------------------------------------------------------------
557  //------------------------------------------------------------------------
558  void UpdateTriedCGI(uint32_t errNo=0);
559 
560  //------------------------------------------------------------------------
562  //------------------------------------------------------------------------
563  void SwitchOnRefreshFlag();
564 
565  //------------------------------------------------------------------------
568  //------------------------------------------------------------------------
569  void HandleRspOrQueue();
570 
571  //------------------------------------------------------------------------
573  //------------------------------------------------------------------------
574  void HandleLocalRedirect( URL *url );
575 
576  //------------------------------------------------------------------------
581  //------------------------------------------------------------------------
582  bool IsRetriable( Message *request );
583 
584  //------------------------------------------------------------------------
591  //------------------------------------------------------------------------
592  bool OmitWait( Message *request, const URL &url );
593 
594  //------------------------------------------------------------------------
600  //------------------------------------------------------------------------
601  bool RetriableErrorResponse( const Status &status );
602 
603  //------------------------------------------------------------------------
605  //------------------------------------------------------------------------
606  void DumpRedirectTraceBack();
607 
614  //------------------------------------------------------------------------
615  template<typename T>
616  Status ReadFromBuffer( char *&buffer, size_t &buflen, T& result );
617 
618  //------------------------------------------------------------------------
625  //------------------------------------------------------------------------
626  Status ReadFromBuffer( char *&buffer, size_t &buflen, std::string &result );
627 
628  //------------------------------------------------------------------------
636  //------------------------------------------------------------------------
637  Status ReadFromBuffer( char *&buffer, size_t &buflen, size_t size,
638  std::string &result );
639 
640  //------------------------------------------------------------------------
641  // Helper struct for async reading of chunks
642  //------------------------------------------------------------------------
643  struct ChunkStatus
644  {
645  ChunkStatus(): sizeError( false ), done( false ) {}
646  bool sizeError;
647  bool done;
648  };
649 
650  typedef std::list<std::unique_ptr<RedirectEntry>> RedirectTraceBack;
651 
652  static const size_t PageSize = XrdSys::PageSize;
653  static const size_t CksumSize = sizeof( uint32_t );
654  static const size_t PageWithCksum = PageSize + CksumSize;
655  static const size_t MaxSslErrRetry = 3;
656 
657  inline static size_t NbPages( uint32_t dlen )
658  {
659  size_t nbpages = dlen / PageWithCksum;
660  if( dlen % PageWithCksum ) ++nbpages;
661  return nbpages;
662  }
663 
664  inline void Copy( uint32_t offchlst, char *buffer, size_t length )
665  {
666  auto itr = pChunkList->begin();
667  while( length > 0 )
668  {
669  // first find the right buffer
670  char *dstbuf = nullptr;
671  size_t cplen = 0;
672  for( ; itr != pChunkList->end() ; ++itr )
673  {
674  if( offchlst < itr->offset ||
675  offchlst >= itr->offset + itr->length )
676  continue;
677  size_t dstoff = offchlst - itr->offset;
678  dstbuf = reinterpret_cast<char*>( itr->buffer ) + dstoff;
679  cplen = itr->length - cplen;
680  break;
681  }
682  // now do the copy
683  if( cplen > length ) cplen = length;
684  memcpy( dstbuf, buffer, cplen );
685  buffer += cplen;
686  length -= cplen;
687  }
688  }
689 
692  std::vector<Message *> pPartialResps;
697  std::shared_ptr<SIDManager> pSidMgr;
701  time_t pExpiration;
708  std::string pRedirectUrl;
711  std::vector<ChunkStatus> pChunkStatus;
714 
715  uint32_t pAsyncOffset;
718  uint32_t pAsyncReadSize;
720  uint32_t pAsyncMsgSize;
721 
724 
725  std::array<char, 4> pPgReadCksumBuff;
726  std::vector<uint32_t> pPgReadCksums;
727 
735 
737 
739 
740  bool pStateful;
742 
743  std::unique_ptr<RedirectEntry> pRdirEntry;
745 
746  bool pMsgInFly;
747 
748  //------------------------------------------------------------------------
749  // true if MsgHandler is both in inQueue and installed in respective
750  // Stream (this could happen if server gave oksofar response), otherwise
751  // false
752  //------------------------------------------------------------------------
753  std::atomic<bool> pTimeoutFence;
754 
755  //------------------------------------------------------------------------
756  // if we are serving chunked data to the user's handler in case of
757  // kXR_dirlist we need to memorize if the response contains stat info or
758  // not (the information is only encoded in the first chunk)
759  //------------------------------------------------------------------------
762 
763  //------------------------------------------------------------------------
764  // synchronization is needed in case the MsgHandler has been configured
765  // to serve kXR_oksofar as a response to the user's handler
766  //------------------------------------------------------------------------
768 
769  //------------------------------------------------------------------------
770  // Count of consecutive `errTlsSslError` errors
771  //------------------------------------------------------------------------
772  size_t pSslErrCnt;
773  };
774 }
775 
776 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:717
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:736
void HandleError(XRootDStatus status, Message *msg=0)
Recover error.
std::vector< Message * > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:692
Definition: XrdClAnyObject.hh:32
URL to
Definition: XrdClXRootDMsgHandler.hh:77
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:44
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:980
Status RetryAtServer(const URL &url, RedirectEntry::Type entryType)
Retry the request at another server.
PostMaster * pPostMaster
Definition: XrdClXRootDMsgHandler.hh:696
void Copy(uint32_t offchlst, char *buffer, size_t length)
Definition: XrdClXRootDMsgHandler.hh:664
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Definition: XProtocol.hh:651
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:645
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:475
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
Definition: XrdClXRootDMsgHandler.hh:407
bool pReadRawStarted
Definition: XrdClXRootDMsgHandler.hh:722
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:204
std::atomic< bool > pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:753
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:412
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:744
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:654
URL from
Definition: XrdClXRootDMsgHandler.hh:76
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:698
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:713
std::string ToString(bool prevok=true)
Definition: XrdClXRootDMsgHandler.hh:81
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:95
Message handler.
Definition: XrdClPostMasterInterfaces.hh:49
virtual XRootDStatus ReadMessageBody(Message *msg, Socket *socket, uint32_t &bytesRead)
std::vector< ChunkStatus > pChunkStatus
Definition: XrdClXRootDMsgHandler.hh:711
std::string GetLocation() const
Get location (protocol://host:port/path)
kXR_unt16 requestid
Definition: XProtocol.hh:156
Definition: XrdClXRootDMsgHandler.hh:643
uint16_t code
Error type, or additional hints on what to do.
Definition: XrdClStatus.hh:145
XRootDMsgHandler(Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler)
Definition: XrdClXRootDMsgHandler.hh:124
kXR_int32 rlen
Definition: XProtocol.hh:505
bool IsOK() const
We&#39;re fine.
Definition: XrdClStatus.hh:122
uint32_t pReadVRawMsgOffset
Definition: XrdClXRootDMsgHandler.hh:728
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:111
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
Definition: XrdClXRootDMsgHandler.hh:399
static Status ReadBytesAsync(Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead)
Read a buffer asynchronously.
bool pReadVRawChunkHeaderDone
Definition: XrdClXRootDMsgHandler.hh:729
Status ParseResponse(AnyObject *&response)
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
Definition: XrdClURL.hh:94
bool pFollowMetalink
Definition: XrdClXRootDMsgHandler.hh:738
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
bool done
Definition: XrdClXRootDMsgHandler.hh:647
Procedure execution status.
Definition: XrdClStatus.hh:112
static const size_t CksumSize
Definition: XrdClXRootDMsgHandler.hh:653
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:694
virtual void Process(Message *msg)
StreamEvent
Events that may have occurred to the stream.
Definition: XrdClPostMasterInterfaces.hh:76
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:690
Status UnPackReadVResponse(Message *msg)
Unpack a single readv response.
Definition: XrdClXRootDMsgHandler.hh:65
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:701
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:325
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:712
static const size_t PageSize
Definition: XrdClXRootDMsgHandler.hh:652
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:697
static Log * GetLog()
Get default log.
XRootDStatus WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:707
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:709
Definition: XrdClXRootDResponses.hh:1033
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:719
Definition: XProtocol.hh:500
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1045
virtual uint16_t Examine(Message *msg)
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:703
static const size_t MaxSslErrRetry
Definition: XrdClXRootDMsgHandler.hh:655
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:761
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:650
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition: XrdClMessage.hh:111
Definition: XrdSysPthread.hh:78
XrdSys::KernelBuffer * pKBuff
Definition: XrdClXRootDMsgHandler.hh:710
std::vector< uint32_t > pPgReadCksums
Definition: XrdClXRootDMsgHandler.hh:726
bool pReadVRawMsgDiscard
Definition: XrdClXRootDMsgHandler.hh:734
static const int PageSize
Definition: XrdSysPageSize.hh:36
Message * pResponse
Definition: XrdClXRootDMsgHandler.hh:691
RedirectEntry(const URL &from, const URL &to, Type type)
Definition: XrdClXRootDMsgHandler.hh:70
bool IsValid() const
Is the url valid.
static size_t NbPages(uint32_t dlen)
Definition: XrdClXRootDMsgHandler.hh:657
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:699
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:79
Request status.
Definition: XrdClXRootDResponses.hh:218
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:695
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.
Type type
Definition: XrdClXRootDMsgHandler.hh:78
int pAggregatedWaitTime
Definition: XrdClXRootDMsgHandler.hh:741
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:387
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:760
void SetRedirectAsAnswer(bool redirectAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:342
Definition: XProtocol.hh:141
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:708
Definition: XrdSysKernelBuffer.hh:45
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1042
Definition: XProtocol.hh:154
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:646
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:702
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:740
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
Vector read info.
Definition: XrdClXRootDResponses.hh:985
Handle an async response.
Definition: XrdClXRootDResponses.hh:1050
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:417
Definition: XrdClLocalFileHandler.hh:32
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:720
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:359
virtual bool IsRaw() const
Are we a raw writer or not?
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:718
URL representation.
Definition: XrdClURL.hh:30
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:715
bool OmitWait(Message *request, const URL &url)
bool pReadVRawSizeError
Definition: XrdClXRootDMsgHandler.hh:731
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:743
HostList * pHosts
Definition: XrdClXRootDMsgHandler.hh:704
int32_t pReadVRawChunkIndex
Definition: XrdClXRootDMsgHandler.hh:732
Definition: XrdClXRootDMsgHandler.hh:64
void WaitDone(time_t now)
size_t pSslErrCnt
Definition: XrdClXRootDMsgHandler.hh:772
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:725
Status pLastError
Definition: XrdClXRootDMsgHandler.hh:700
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:723
const uint16_t suRetry
Definition: XrdClStatus.hh:40
time_t GetExpiration()
Get a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:333
Definition: XrdClXRootDMsgHandler.hh:67
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:47
Type
Definition: XrdClXRootDMsgHandler.hh:62
bool pReadVRawChunkHeaderStarted
Definition: XrdClXRootDMsgHandler.hh:730
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:706
static PostMaster * GetPostMaster()
Get default post master.
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:109
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:767
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:705
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:693
Definition: XrdClXRootDMsgHandler.hh:60
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:746
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:461
A network socket.
Definition: XrdClSocket.hh:41
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:351
void DumpRedirectTraceBack()
Dump the redirect-trace-back into the log file.
virtual uint16_t InspectStatusRsp(Message *msg)
Handle diagnostics.
Definition: XrdClLog.hh:100
void SetLoadBalancer(const HostInfo &loadBalancer)
Set the load balancer.
Definition: XrdClXRootDMsgHandler.hh:367
uint32_t pAsyncChunkOffset
Definition: XrdClXRootDMsgHandler.hh:716
Definition: XrdClXRootDMsgHandler.hh:66
readahead_list pReadVRawChunkHeader
Definition: XrdClXRootDMsgHandler.hh:733
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:378