Esempio n. 1
0
static int cmd_del_output(int argc, const char **argv)
{
	int ret;
	char *name;
	long id;

	if (argc < 2) {
		usage(stderr);
		ret = CMD_ERROR;
		goto end;
	}

	errno = 0;
	id = strtol(argv[1], &name, 10);
	if (id == 0 && errno == 0) {
		if (lttng_opt_mi) {
			ret = mi_del_output(UINT32_MAX, name);
		} else {
			ret = del_output(UINT32_MAX, name);
		}
	} else if (errno == 0 && *name == '\0') {
		if (lttng_opt_mi) {
			ret = mi_del_output(id, NULL);
		} else {
			ret = del_output(id, NULL);
		}
	} else {
		ERR("Argument %s not recognized", argv[1]);
		ret = -1;
		goto end;
	}

end:
	return ret;
}
Esempio n. 2
0
void mgr_on_close(int fd, event_manager* ev_mgr)
{
    if (internal_threads(ev_mgr->excluded_threads, pthread_self()))
        return;
    
    del_output(fd);
    uint32_t leader_id = get_leader_id(ev_mgr->con_node);
    if (ev_mgr->node_id == leader_id)
    {
        leader_tcp_pair* ret = NULL;
        HASH_FIND_INT(ev_mgr->leader_tcp_map, &fd, ret);
        if (ret == NULL)
            goto mgr_on_close_exit;

        view_stamp close_vs = ret->vs;
        HASH_DEL(ev_mgr->leader_tcp_map, ret);

        rsm_op(ev_mgr->con_node, 0, NULL, P_CLOSE, &close_vs);
        // nop is only for sending the close() consensus result to the replicas.
        rsm_op(ev_mgr->con_node, 0, NULL, P_NOP, NULL);
    }
mgr_on_close_exit:
    return;
}