Skip to content

Commit

Permalink
[XrdCl] Do not reuse sessionId when a new Stream object is made
Browse files Browse the repository at this point in the history
  • Loading branch information
smithdh authored and amadio committed Mar 21, 2023
1 parent 8e4965c commit 87340a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/XrdCl/XrdClStream.cc
Expand Up @@ -44,6 +44,11 @@

namespace XrdCl
{
//----------------------------------------------------------------------------
// Statics
//----------------------------------------------------------------------------
RAtomic_uint64_t Stream::sSessCntGen{0};

//----------------------------------------------------------------------------
// Incoming message helper
//----------------------------------------------------------------------------
Expand Down Expand Up @@ -615,7 +620,7 @@ namespace XrdCl
pLastFatalError = XRootDStatus();
pConnectionCount = 0;
uint16_t numSub = pTransport->SubStreamNumber( *pChannelData );
++pSessionId;
pSessionId = ++sSessCntGen;

//------------------------------------------------------------------------
// Create the streams if they don't exist yet
Expand Down
6 changes: 6 additions & 0 deletions src/XrdCl/XrdClStream.hh
Expand Up @@ -29,6 +29,7 @@
#include "XrdCl/XrdClUtils.hh"

#include "XrdSys/XrdSysPthread.hh"
#include "XrdSys/XrdSysRAtomic.hh"
#include "XrdNet/XrdNetAddr.hh"
#include <list>
#include <vector>
Expand Down Expand Up @@ -371,6 +372,11 @@ namespace XrdCl
// Data stream on-connect handler
//------------------------------------------------------------------------
std::shared_ptr<Job> pOnDataConnJob;

//------------------------------------------------------------------------
// Track last assigned Id across all Streams, to ensure unique sessionId
//------------------------------------------------------------------------
static RAtomic_uint64_t sSessCntGen;
};
}

Expand Down

0 comments on commit 87340a4

Please sign in to comment.