cmRtNet.c : _cmRtNetCreateNode() now reuses a node record if a new node with

the same name as an existing node attempts to synchronize.
This commit is contained in:
kpl 2014-06-16 11:39:10 -07:00
parent e4cef833d0
commit 4012928a4b

View File

@ -191,16 +191,18 @@ cmRtNetRC_t _cmRtNetCreateNode( cmRtNet_t* p, const cmChar_t* label, unsigned rt
return cmErrMsg(&p->err,kInvalidLabelNetRC,"A null or blank node label was encountered."); return cmErrMsg(&p->err,kInvalidLabelNetRC,"A null or blank node label was encountered.");
if((np = _cmRtNetFindNode(p,label)) != NULL ) if((np = _cmRtNetFindNode(p,label)) != NULL )
return cmErrMsg(&p->err,kDuplLabelNetRC,"The node label '%s' is already in use.",cmStringNullGuard(label)); cmErrWarnMsg(&p->err,kDuplLabelNetRC,"The node label '%s' is already in use.",cmStringNullGuard(label));
else
{
np = cmMemAllocZ(cmRtNetNode_t,1); np = cmMemAllocZ(cmRtNetNode_t,1);
np->label = cmMemAllocStr(label); np->label = cmMemAllocStr(label);
}
if( saddr != NULL ) if( saddr != NULL )
np->sockaddr = *saddr; np->sockaddr = *saddr;
np->rtSubIdx = rtSubIdx; np->rtSubIdx = rtSubIdx;
np->addr = addr==NULL ? NULL : cmMemAllocStr(addr); np->addr = addr==NULL ? NULL : cmMemResizeStr(np->addr,addr);
np->port = port; np->port = port;
np->flags = flags; np->flags = flags;
np->endPtCnt = endPtCnt; np->endPtCnt = endPtCnt;