Skip to content

Commit

Permalink
Make is impossible to hang on a forced disconnect.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Dec 6, 2016
1 parent 5daadb0 commit 45f4f0d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/XrdCms/XrdCmsCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -816,21 +816,24 @@ void XrdCmsCluster::Remove(const char *reason, XrdCmsNode *theNode, int immed)
//
theNode->isOffline = 1; // STMutex is held here

// If the node is connected the simply close the connection. This will cause
// the connection handler to re-initiate the node removal. The LockHandler
// destructor will release the node table and node object locks as needed.
// This condition exists only if one node is being displaced by another node.
// If the node is connected we simply close the connection. This will cause
// the connection handler to re-initiate the node removal. This condition
// exists only if one node is being displaced by another node. The Disc()
// may take a long time, but it's done async by default on the WAN and sync
// on the LAN (local connections are fast enough and error-free for this).
//
if (theNode->isConn)
{theNode->Disc(reason, 0);
theNode->isGone = 1;
theNode->isGone = 1; // Disc() sets the isOffline flag
return;
}

// If we are not the primary node, then get rid of this node post-haste
//
if (!(NodeTab[NodeID] == theNode))
{Say.Emsg("Remove_Node", theNode->Ident, "dropped as alternate.");
{const char *why = (theNode->isMan ? "dropped as alternate."
: "dropped and redirected.");
Say.Emsg("Remove_Node", theNode->Ident, why);
LockHandler.doDrop = true;
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/XrdCms/XrdCmsNode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,12 @@ void XrdCmsNode::Disc(const char *reason, int needLock)
if (needLock) nodeMutex.Lock();
isOffline = 1; // STMutex is already held if needed

// If we are still connected, initiate a teardown
// If we are still connected, initiate a teardown. This may be done async as
// we are asking for a defered close which will be followed by a full close.
//
if (isConn)
{Link->setEtext(reason);
Link->Close();
Link->Close(1);
isConn = 0;
}

Expand Down
3 changes: 2 additions & 1 deletion src/XrdCms/XrdCmsTypes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ typedef unsigned long long SMask_t;

// The following defines our cell size (maximum subscribers)
//
#define STMax 64
//#define STMax 64
#define STMax 1

// The following defines the maximum number of redirectors. It is one greater
// than the actual maximum as the zeroth is never used.
Expand Down

0 comments on commit 45f4f0d

Please sign in to comment.