/* Initialize the connection pool. * No possible errors. * Assert Class: 1 */ void pool_init () { xa_debug (1, "DEBUG: Initializing Connection Pool."); thread_create_mutex (&pool_mutex); pool = avl_create (compare_connection, &info); }
/* * Reset the network card(s). * * This function is called each time the system is reset, * either a hard reset (including power-up) or a soft reset * including C-A-D reset.) It is responsible for connecting * everything together. */ void network_reset(void) { int i = -1; #ifdef ENABLE_NIC_LOG network_log("NETWORK: reset (type=%d, card=%d) debug=%d\n", network_type, network_card, nic_do_log); #else network_log("NETWORK: reset (type=%d, card=%d)\n", network_type, network_card); #endif ui_sb_update_icon(SB_NETWORK, 0); /* Just in case.. */ network_close(); /* If no active card, we're done. */ if ((network_type==NET_TYPE_NONE) || (network_card==0)) return; network_mutex = thread_create_mutex(L"VARCem.NetMutex"); /* Initialize the platform module. */ switch(network_type) { case NET_TYPE_PCAP: i = net_pcap_init(); break; case NET_TYPE_SLIRP: i = net_slirp_init(); break; } if (i < 0) { /* Tell user we can't do this (at the moment.) */ ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2102); // FIXME: we should ask in the dialog if they want to // reconfigure or quit, and throw them into the // Settings dialog if yes. /* Disable network. */ network_type = NET_TYPE_NONE; return; } network_log("NETWORK: set up for %s, card='%s'\n", (network_type==NET_TYPE_SLIRP)?"SLiRP":"Pcap", net_cards[network_card].name); /* Add the (new?) card to the I/O system. */ if (net_cards[network_card].device) { network_log("NETWORK: adding device '%s'\n", net_cards[network_card].name); device_add(net_cards[network_card].device); } }