remove node from the netinfo list */
| 3662 | |
| 3663 | /* remove node from the netinfo list */ |
| 3664 | void 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 | |
| 3696 | struct net_decom_node_arg { |
| 3697 | netinfo_type *netinfo_ptr; |
no outgoing calls
no test coverage detected