MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / net_decom_node

Function net_decom_node

net/net.c:3664–3694  ·  view source on GitHub ↗

remove node from the netinfo list */

Source from the content-addressed store, hash-verified

3662
3663/* remove node from the netinfo list */
3664void net_decom_node(netinfo_type *netinfo_ptr, const char *host)
3665{
3666 if (host && netinfo_ptr->myhostname == host) {
3667 return;
3668 }
3669
3670 Pthread_rwlock_wrlock(&(netinfo_ptr->lock));
3671
3672 /* remove the host node from the netinfo list */
3673 host_node_type *host_ptr, *host_back;
3674 host_back = host_ptr = netinfo_ptr->head;
3675 while (host_ptr != NULL && host_ptr->host != host) {
3676 host_back = host_ptr;
3677 host_ptr = host_ptr->next;
3678 }
3679 if (host_ptr != NULL) {
3680 if (host_ptr == netinfo_ptr->head)
3681 netinfo_ptr->head = host_ptr->next;
3682 else
3683 host_back->next = host_ptr->next;
3684
3685 host_ptr->decom_flag = 1;
3686
3687 if (host_ptr == netinfo_ptr->last_used_node_ptr)
3688 netinfo_ptr->last_used_node_ptr = NULL; // clear last_used_node_ptr
3689 }
3690
3691 /* we can't free the host node pointer memory -
3692 let the connect thread do that */
3693 Pthread_rwlock_unlock(&(netinfo_ptr->lock));
3694}
3695
3696struct net_decom_node_arg {
3697 netinfo_type *netinfo_ptr;

Callers 5

hostdown_threadFunction · 0.85
berkdb_receive_msgFunction · 0.85
net_decom_node_delayedFunction · 0.85
process_decom_intFunction · 0.85
osql_decom_nodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected