XrdClientLogConnection.cc

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////
00002 //                                                                      //
00003 // XrdClientLogConnection                                               //
00004 //                                                                      //
00005 // Author: Fabrizio Furano (INFN Padova, 2004)                          //
00006 // Adapted from TXNetFile (root.cern.ch) originally done by             //
00007 //  Alvise Dorigo, Fabrizio Furano                                      //
00008 //          INFN Padova, 2003                                           //
00009 //                                                                      //
00010 // Class implementing logical connections                               //
00011 //                                                                      //
00012 //////////////////////////////////////////////////////////////////////////
00013 
00014 //       $Id: XrdClientLogConnection.cc 30949 2009-11-02 16:37:58Z ganis $
00015 
00016 const char *XrdClientLogConnectionCVSID = "$Id: XrdClientLogConnection.cc 30949 2009-11-02 16:37:58Z ganis $";
00017 
00018 #include "XrdClient/XrdClientLogConnection.hh"
00019 #include "XrdClient/XrdClientPhyConnection.hh"
00020 #include "XrdClient/XrdClientDebug.hh"
00021 #include "XrdClient/XrdClientSid.hh"
00022 
00023 
00024 
00025 //_____________________________________________________________________________
00026 XrdClientLogConnection::XrdClientLogConnection(XrdClientSid *sidmgr):
00027   fSidManager(sidmgr) {
00028 
00029    // Constructor
00030 
00031    fPhyConnection = 0;
00032    fStreamid = fSidManager ? fSidManager->GetNewSid() : 0;
00033 }
00034 
00035 //_____________________________________________________________________________
00036 XrdClientLogConnection::~XrdClientLogConnection() {
00037    // Destructor
00038 
00039    // Decrement counter in the reference phy conn
00040    if (fPhyConnection)
00041       fPhyConnection->CountLogConn(-1);
00042    if (fSidManager) 
00043       fSidManager->ReleaseSidTree(fStreamid);
00044 }
00045 
00046 //_____________________________________________________________________________
00047 int XrdClientLogConnection::WriteRaw(const void *buffer, int bufferlength,
00048                                      int substreamid)
00049 {
00050    // Send over the open physical connection 'bufferlength' bytes located
00051    // at buffer.
00052    // Return number of bytes sent.
00053 
00054    Info(XrdClientDebug::kDUMPDEBUG,
00055         "WriteRaw",
00056         "Writing " << bufferlength << " bytes to physical connection");
00057   
00058    return fPhyConnection->WriteRaw(buffer, bufferlength, substreamid);
00059 }
00060 
00061 //_____________________________________________________________________________
00062 int XrdClientLogConnection::ReadRaw(void *buffer, int bufferlength)
00063 {
00064    // Receive from the open physical connection 'bufferlength' bytes and 
00065    // save in buffer.
00066    // Return number of bytes received.
00067 
00068    Info(XrdClientDebug::kDUMPDEBUG,
00069         "ReadRaw",
00070         "Reading " << bufferlength << " bytes from physical connection");
00071 
00072    return fPhyConnection->ReadRaw(buffer, bufferlength);
00073   
00074 
00075 }
00076 
00077 //_____________________________________________________________________________
00078 UnsolRespProcResult XrdClientLogConnection::ProcessUnsolicitedMsg(XrdClientUnsolMsgSender *sender,
00079                                                                   XrdClientMessage *unsolmsg)
00080 {
00081    // We are here if an unsolicited response comes from the connmgr
00082    // The response comes in the form of an XrdClientMessage *, that must NOT be
00083    // destroyed after processing. It is destroyed by the first sender.
00084    // Remember that we are in a separate thread, since unsolicited responses
00085    // are asynchronous by nature.
00086 
00087    //Info(XrdClientDebug::kDUMPDEBUG, "LogConnection",
00088    //     "Processing unsolicited response (ID:"<<unsolmsg->HeaderSID()<<")");
00089 
00090    // Local processing ....
00091 
00092    // We propagate the event to the obj which registered itself here
00093    return SendUnsolicitedMsg(sender, unsolmsg);
00094 
00095 }

Generated on Tue Jul 5 14:46:18 2011 for ROOT_528-00b_version by  doxygen 1.5.1