lagopus_result_t channel_mgr_channel_connection_status_get(const char *channel_name, datastore_channel_status_t *status) { lagopus_result_t ret; struct channel *chan; ret = channel_mgr_channel_lookup_by_name(channel_name, &chan); if (ret != LAGOPUS_RESULT_OK) { return ret; } if (channel_is_alive(chan)) { *status = DATASTORE_CHANNEL_CONNECTED; } else { *status = DATASTORE_CHANNEL_DISONNECTED; } return LAGOPUS_RESULT_OK; }
static lagopus_result_t ofp_role_write(struct channel *channel, void *val) { struct role_write_vars *v = val; if (channel_is_alive(channel) == true) { /* packet filtering. */ if (channel_role_channel_check_mask(channel, v->type, v->reason) == true) { v->ret = ofp_write_channel(channel, v->pbuf); } else { /* Not send packet. */ v->ret = LAGOPUS_RESULT_OK; } } else { lagopus_msg_debug(1, "Channel is not alive, drop asynchronous message(%s)\n", ofp_type_str(v->type)); /* Not send packet. */ v->ret = LAGOPUS_RESULT_OK; } return LAGOPUS_RESULT_OK; }
static lagopus_result_t channel_unset_dpid(const char *channel_name) { uint64_t dpid; lagopus_result_t ret; struct channel *chan = NULL; struct channel_list *chan_list = NULL; ret = lagopus_hashmap_find(&main_table, (void *)channel_name, (void **)&chan); if (chan == NULL) { return LAGOPUS_RESULT_NOT_FOUND; } if (channel_is_alive(chan) == true) { return LAGOPUS_RESULT_BUSY; } dpid = channel_dpid_get(chan); if (dpid == UNUSED_DPID) { return LAGOPUS_RESULT_OK; } ret = lagopus_hashmap_find(&dp_table, (void *)dpid, (void **)&chan_list); if (ret != LAGOPUS_RESULT_OK) { return ret; } ret = channel_list_delete(chan_list, chan); if (ret != LAGOPUS_RESULT_OK) { return ret; } ret = channel_dpid_set(chan, UNUSED_DPID); if (ret != LAGOPUS_RESULT_OK) { return ret; } return ret; }