Skip to content

Commit

Permalink
Revert "[XrdCl] Avoid segv caused by reconnect vs force disconnect."
Browse files Browse the repository at this point in the history
This reverts commit ce1954b.
  • Loading branch information
amadio committed May 7, 2023
1 parent ba9a395 commit a4d12c3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 51 deletions.
9 changes: 0 additions & 9 deletions src/XrdCl/XrdClChannel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,6 @@ namespace XrdCl
return Status();
}

//----------------------------------------------------------------------------
// Force reconnect
//----------------------------------------------------------------------------
Status Channel::ForceReconnect()
{
pStream->ForceConnect();
return Status();
}

//------------------------------------------------------------------------
// Get the number of connected data streams
//------------------------------------------------------------------------
Expand Down
5 changes: 0 additions & 5 deletions src/XrdCl/XrdClChannel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ namespace XrdCl
//------------------------------------------------------------------------
Status ForceDisconnect();

//------------------------------------------------------------------------
//! Force reconnect
//------------------------------------------------------------------------
Status ForceReconnect();

//------------------------------------------------------------------------
//! Get the number of connected data streams
//------------------------------------------------------------------------
Expand Down
19 changes: 1 addition & 18 deletions src/XrdCl/XrdClPostMaster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,7 @@ namespace XrdCl
AnyObject &result )
{
XrdSysRWLockHelper scopedLock( pImpl->pDisconnectLock );
PostMasterImpl::ChannelMap::iterator it =
pImpl->pChannelMap.find( url.GetChannelId() );
if( it == pImpl->pChannelMap.end() )
return Status( stError, errInvalidOp );
Channel *channel = it->second;
Channel *channel = GetChannel( url );

if( !channel )
return Status( stError, errNotSupported );
Expand Down Expand Up @@ -324,19 +320,6 @@ namespace XrdCl
return Status();
}

Status PostMaster::ForceReconnect( const URL &url )
{
XrdSysRWLockHelper scopedLock( pImpl->pDisconnectLock, false );
PostMasterImpl::ChannelMap::iterator it =
pImpl->pChannelMap.find( url.GetChannelId() );

if( it == pImpl->pChannelMap.end() )
return Status( stError, errInvalidOp );

it->second->ForceReconnect();
return Status();
}

//------------------------------------------------------------------------
// Get the number of connected data streams
//------------------------------------------------------------------------
Expand Down
5 changes: 0 additions & 5 deletions src/XrdCl/XrdClPostMaster.hh
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ namespace XrdCl
//------------------------------------------------------------------------
Status ForceDisconnect( const URL &url );

//------------------------------------------------------------------------
//! Reconnect the channel
//------------------------------------------------------------------------
Status ForceReconnect( const URL &url );

//------------------------------------------------------------------------
//! Get the number of connected data streams
//------------------------------------------------------------------------
Expand Down
25 changes: 11 additions & 14 deletions src/XrdCl/XrdClStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,11 @@ namespace XrdCl
void Stream::ForceConnect()
{
XrdSysMutexHelper scopedLock( pMutex );
if( pSubStreams[0]->status == Socket::Connecting )
{
pSubStreams[0]->status = Socket::Disconnected;
XrdCl::PathID path( 0, 0 );
XrdCl::XRootDStatus st = EnableLink( path );
if( !st.IsOK() )
OnConnectError( 0, st );
}
pSubStreams[0]->status = Socket::Disconnected;
XrdCl::PathID path( 0, 0 );
XrdCl::XRootDStatus st = EnableLink( path );
if( !st.IsOK() )
OnConnectError( 0, st );
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -402,11 +399,11 @@ namespace
//------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------
StreamConnectorTask( const XrdCl::URL &url, const std::string &n ):
url( url )
StreamConnectorTask( XrdCl::Stream *stream ):
pStream( stream )
{
std::string name = "StreamConnectorTask for ";
name += n;
name += stream->GetName();
SetName( name );
}

Expand All @@ -415,12 +412,12 @@ namespace
//------------------------------------------------------------------------
time_t Run( time_t )
{
XrdCl::DefaultEnv::GetPostMaster()->ForceReconnect( url );
pStream->ForceConnect();
return 0;
}

private:
XrdCl::URL url;
XrdCl::Stream *pStream;
};
}

Expand Down Expand Up @@ -778,7 +775,7 @@ namespace XrdCl
log->Info( PostMasterMsg, "[%s] Attempting reconnection in %d "
"seconds.", pStreamName.c_str(), pConnectionWindow-elapsed );

Task *task = new ::StreamConnectorTask( *pUrl, pStreamName );
Task *task = new ::StreamConnectorTask( this );
pTaskManager->RegisterTask( task, pConnectionInitTime+pConnectionWindow );
return;
}
Expand Down

0 comments on commit a4d12c3

Please sign in to comment.