//----------------------------------------------------------------------------- public SilkroadServer CreateNew(string bind_addr, int bind_port, string module_addr, int module_port, ServerType srvtype, bool blowfish, bool sec_bytes, bool handshake, PacketDispatcher packetProcessor, DelayedPacketDispatcher delayedPacketDispatcher, List<RedirectRule> redirs = null) { if (BindExists(bind_addr, bind_port)) { Global.logmgr.WriteLog(LogLevel.Error, "Server with given bind address already exists [{0}:{1}]", bind_addr, bind_port); return null; } try { SilkroadServer ServerItem = new SilkroadServer( new IPEndPoint(IPAddress.Parse(bind_addr), bind_port), new IPEndPoint(IPAddress.Parse(module_addr), module_port), srvtype, blowfish, sec_bytes, handshake, packetProcessor, delayedPacketDispatcher, redirs ); m_servers.Add(ServerItem); ServerItem.Start(); return ServerItem; } catch { Global.logmgr.WriteLog(LogLevel.Error, "ServerManager failed to start server, SilkroadServer start error"); } return null; }
public void RegisterModuleMsg(DelayedPacketProcessor handlerType, SilkroadServer server, int delay, string noticeMsg) { lock (m_class_lock) { m_module_timers.Add(new PacketTimer(handlerType, server, delay, noticeMsg)); } }
public PacketTimer(DelayedPacketProcessor handlerType, SilkroadServer server, int delay, object stateObj) { this.HandlerType = handlerType; this.Server = server; this.Interval = delay; this.Enabled = true; this.StateObj = stateObj; this.Elapsed += new ElapsedEventHandler(OnTimerElapsed); }
public void AssignServer(SilkroadServer server) { m_server = server; }