コード例 #1
0
ファイル: poa-manager.c プロジェクト: 3v3vuln/ORBit2
PortableServer_POAManager
ORBit_POAManager_new (CORBA_ORB orb)
{
	PortableServer_POAManager retval;

	retval = g_new0 (struct PortableServer_POAManager_type, 1);
	ORBit_RootObject_init (&retval->parent, &CORBA_POAManager_epv);
	retval->state = PortableServer_POAManager_HOLDING;
	retval->orb = orb;

	return retval;
}
コード例 #2
0
ファイル: corba-context.c プロジェクト: ErisBlastar/voyager
static CORBA_Context
CORBA_Context_new (CORBA_Context      parent,
		   const char        *name,
		   CORBA_Environment *ev)
{
	CORBA_Context retval;

	retval = g_new0 (struct CORBA_Context_type, 1);

	ORBit_RootObject_init (&retval->parent, &CORBA_Context_epv);

	if (name)
		retval->the_name = g_strdup (name);

	retval->parent_ctx = parent;
	if (parent)
		parent->children = g_slist_prepend (parent->children, retval);

	return ORBit_RootObject_duplicate (retval);
}
コード例 #3
0
ファイル: corba-orb.c プロジェクト: 3v3vuln/ORBit2
CORBA_ORB
CORBA_ORB_init (int *argc, char **argv,
		CORBA_ORBid orb_identifier,
		CORBA_Environment *ev)
{
	gboolean thread_safe;
	CORBA_ORB retval;
	static ORBit_RootObject_Interface orb_if = {
		ORBIT_ROT_ORB,
		CORBA_ORB_release_fn
	};

	init_level++;

	if ((retval = _ORBit_orb))
		return ORBit_RootObject_duplicate (retval);

	/* the allocation code uses the bottom bit of any pointer */
	g_assert (ORBIT_ALIGNOF_CORBA_DOUBLE > 2);

	if (orb_identifier &&
	    strstr (orb_identifier, "orbit-local-non-threaded-orb") != NULL)
		thread_safe = FALSE;
	else
		thread_safe = TRUE;

	ORBit_option_parse (argc, argv, orbit_supported_options);
	
#ifdef G_ENABLE_DEBUG
	ORBit_setup_debug_flags ();

	if (_orbit_debug_flags & ORBIT_DEBUG_FORCE_THREADED) {
		g_warning ("-- Forced orb into threaded mode --");
		thread_safe |= TRUE;
	}
#endif /* G_ENABLE_DEBUG */

	giop_recv_set_limit (orbit_initial_recv_limit);
	giop_set_timeout (orbit_timeout_msec);
	giop_init (thread_safe,
		   orbit_use_ipv4 || orbit_use_ipv6 ||
		   orbit_use_irda || orbit_use_ssl);

	if (orb_identifier && thread_safe &&
	    strstr (orb_identifier, "orbit-io-thread") != NULL)
		link_set_io_thread (TRUE);

	genuid_init ();
	_ORBit_object_init ();
	ORBit_poa_init ();

	ORBit_locks_initialize ();

	retval = g_new0 (struct CORBA_ORB_type, 1);

	ORBit_RootObject_init (&retval->root_object, &orb_if);
	/* released by CORBA_ORB_destroy */
	_ORBit_orb = ORBit_RootObject_duplicate (retval);
	_ORBit_orb->lock = link_mutex_new ();
#ifndef G_OS_WIN32
	/* atexit(), which g_atexit() is just a #define for on Win32,
	 * often causes breakage when invoked from DLLs. It causes the
	 * registered function to be called when the calling DLL is
	 * being unloaded. At that time, however, random other DLLs
	 * might also have already been unloaded. There is no
	 * guarantee WinSock even works any longer. Etc. Best to avoid
	 * atexit() completely on Win32, and hope that just exiting
	 * the process and thus severing all connections will be
	 * noticed by all peers the process was connected to and acted
	 * upon properly.
	 *
	 * In the evolution-exchange-storage process's case, the
	 * shutdown_orb() function caused the process to hang and not
	 * exit, leaving the sockets it was listening on still in a
	 * LISTEN state. bonobo-activation-server thought the bonobo
	 * servers in evolution-exchange-storage were still OK and
	 * tried to contact them when Evolution was started the next
	 * time, causing it to hang, too.
	 */
	g_atexit (shutdown_orb);
#endif

	retval->default_giop_version = GIOP_LATEST;

	retval->adaptors = g_ptr_array_new ();

	/* init the forward bind hashtable*/
	retval->forw_binds = g_hash_table_new_full (
		g_str_hash, g_str_equal,
		g_free,
		NULL); 

	ORBit_init_internals (retval, ev);
	/* FIXME, handle exceptions */ 

	ORBit_initial_references_by_user (retval, 
					  orbit_naming_ref,
					  orbit_initref_list,
					  ev);
	/* FIXME, handle exceptions */ 

	return ORBit_RootObject_duplicate (retval);
}