Ejemplo n.º 1
0
    void doSendEndpoints (IP::Endpoint const& remote_endpoint,
        Endpoints const& endpoints)
    {
        Links::iterator const iter1 (std::find_if (
            links().begin (), links().end(),
                is_remote_endpoint (remote_endpoint)));
        if (iter1 != links().end())
        {
            // Drop the message if they closed their end
            if (iter1->closed ())
                return;
            Node& remote_node (iter1->remote_node());
            // Find their link to us
            Links::iterator const iter2 (std::find_if (
                remote_node.links().begin(), remote_node.links().end(),
                    is_remote_endpoint (iter1->local_endpoint ())));
            consistency_check (iter2 != remote_node.links().end());

            //
            // VFALCO NOTE This looks wrong! Shouldn't it call receive()
            //             on the link and not the Peer?
            //
            Message const m (endpoints);
            iter2->local_node().receive (*iter2, m);
            //iter2->post (m);
        }
    }
Ejemplo n.º 2
0
 void send(const transport_msg<Alloc>& a_msg) throw (err_connection) {
     if (!m_transport)
         if (m_abort)
             return;
         else
             throw err_connection("Not connected to node", remote_node());
     m_transport->send(a_msg);
 }
Ejemplo n.º 3
0
    void doDisconnectPeer (IP::Endpoint const& remote_endpoint, bool graceful)
    {
        // Find our link to them
        Links::iterator const iter1 (std::find_if (
            m_links.begin(), m_links.end(),
                is_remote_endpoint (remote_endpoint)));
        if (iter1 == m_links.end())
            return;
        Node& remote_node (iter1->remote_node());
        IP::Endpoint const local_endpoint (iter1->local_endpoint());
        // Find their link to us
        Links::iterator const iter2 (std::find_if (
            remote_node.links().begin(), remote_node.links().end(),
                is_remote_endpoint (local_endpoint)));
        if (iter2 != remote_node.links().end())
        {
            // Notify the remote that we closed
            check_invariant (! iter2->closed());
            iter2->close();
            m_network.post (std::bind (&Node::doClosed,
                &remote_node, local_endpoint, graceful));
        }
        if (! iter1->closed ())
        {
            // Remove our link to them
            m_links.erase (iter1);
            // Notify
            m_network.post (std::bind (&Logic::on_closed,
                &logic(), remote_endpoint));
        }

        /*
        if (! graceful || ! iter2->pending ())
        {
            remote_node.links().erase (iter2);
            remote_node.logic().on_closed (local_endpoint);
        }
        */
    }
Ejemplo n.º 4
0
main()
{
	mach_port_t 	bootstrap_port;
	int	 	i;
	struct test_dir *td, **tds;
	int 		all;
	kern_return_t 	kr;
	boolean_t 	found;
	int 		argc = 0;
	char 		**argv;


	MACH_CALL(task_get_special_port, (mach_task_self(),
                                       TASK_BOOTSTRAP_PORT,
                                       &bootstrap_port));
	MACH_CALL(bootstrap_ports, (bootstrap_port,
					&privileged_host_port,
					&master_device_port,
					&root_ledger_wired,
					&root_ledger_paged,
					&security_port));

	MACH_FUNC(host_port, mach_host_self, ());

	standalone = is_standalone();

	threads_init();
	console_init();
	_printf_init();
	exception_init();

	printf("\n\n");
	version();
	kernel_version();
	if (standalone)
		printf("Standalone mode\n\n");

	vm_opt = 1;
	print_vm_stats();
	printf("\n");
	get_thread_sched_attr(mach_thread_self(),
			    (policy_state_t) 0,
			    TRUE);
	printf("\n");
	while(1) {
		mach_setjmp(&sa_jmp_buf);
		reset_options();
                /* synthetic benchmarks are not the default type */
                synthetic_fn = NULL;
		reset_more();
		if (!(argc = read_cmd(&argv, "mpts> ")))
			continue;
		for (i = 1; i < argc; i++)
			is_gen_opt(argc, argv, &i, 0, 0);
		if (!strcmp(argv[0],"on")) {
		  	shift_args(&argc, argv);
			if (remote_node(argc, argv)) {
				shift_args(&argc, argv);
			} else {
				interruptible_cmd(usage, 0, 0);
				continue;
			}
		} 
		if (!strcmp(argv[0],"more")) {
			shift_args(&argc, argv);
		} else
			disable_more();
		all = strcmp(argv[0],"*") ? 0 : 1;
		for (found = FALSE, tds = test_dirs; *tds && !found; tds++)
		    for (td = *tds; td->name && !found; td++)
			if ((all && td->is_a_test) 
			    || !strcmp(argv[0],td->name)) {
				if (td->is_a_test)
					printf("_______________________________________________________________________________\n");
			  	argv[0] = td->name;
				if (td->is_a_test)
					interruptible_cmd(td->func,
							  argc,
							  argv);
				else
					(*td->func) (argc, argv);
				if (!all)
					found = TRUE;
			}
		if ((!all) && (!found)) {
                    if (find_proc(argv[0]))
                        /* run synthetic benchmark if we have a proc name */
                        interruptible_cmd(synthetic,argc,argv);
                    else
			interruptible_cmd(usage, 0, 0);
		}
	}
	printf("done\n");
}