public void socket_init(timer timer) { // Maximum packet size in bytes, which the client is able to handle. // Larger packets cause a buffer overflow and stack corruption. if (mmo.PACKETVER < 20131223) { socket_max_client_packet = 24576; } else { socket_max_client_packet = 65636; } string SOCKET_CONF_FILENAME = @"conf\packet_athena.conf"; access_allow = new List <AccessControl>(); access_deny = new List <AccessControl>(); session = new socket_data[FD_SETSIZE]; session[0] = new socket_data(); // Get initial local ips addr_ = new short[16]; naddr_ = getips(ref addr_, 16); if (SEND_SHORTLIST) { send_shortlist_set = new int[(FD_SETSIZE + 31) / 32]; } config_read(SOCKET_CONF_FILENAME); // initialise last send-receive tick last_tick = timer.time(null); // session[0] is now currently used for disconnected sessions of the map server, and as such, // should hold enough buffer (it is a vacuum so to speak) as it is never flushed. [Skotlex] create_session(0); // Delete old connection history every 5 minutes connect_history = new ConnectHistory[0x10000]; timer.add_timer_interval(timer.time(null) + 1000, "connect_check_clear", null, 0, 5 * 60 * 1000); console.info("Server supports up to '" + FD_SETSIZE + "' concurrent connections."); }
/// <summary> /// Login server initialization /// </summary> static private void do_init(string login_conf, string lan_conf) { set_defaults(); config_read(login_conf); lan_config_read(lan_conf); server = new mmo_char_server[MAX_SERVERS]; // initialize logging if (login_config.log_login) { loginlog_init(); } // initialize static and dynamic ipban system if (login_config.ipban) { ipban_init(); } // Online user database init online_db = new List <online_login_data>(); // Interserver auth init auth_db = new List <auth_node>(); // set default parser as parse_login function socket.set_defaultparse("parse_login"); // every 10 minutes cleanup online account db. timer.add_timer_interval(timer.time(null) + 600 * 1000, "online_data_cleanup", null, 0, 600 * 1000); // add timer to detect ip address change and perform update if (login_config.ip_sync_interval > 0) { timer.add_timer_interval(timer.time(null) + login_config.ip_sync_interval, "sync_ip_addresses", null, 0, (int)login_config.ip_sync_interval); } return; }