コード例 #1
0
        //-----------------------------------------------------------------------------
        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;
        }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 public void AssignServer(SilkroadServer server)
 {
     m_server = server;
 }
コード例 #6
0
 public void AssignServer(SilkroadServer server)
 {
     m_server = server;
 }