示例#1
0
 internal Scheduler(Server server)
 {
     this.server = server;
     timers = new List<Timer>();
     lastTick = Environment.TickCount;
     pendingTimers = new ConcurrentQueue<Timer>();
 }
示例#2
0
        public void Initialize()
        {
            server = new Server(Config.defaults);

            server.Start();
            server.Wait();

            Console.WriteLine("Initialize");
        }
示例#3
0
        static void Main(string[] args)
        {
            var config = Config.defaults;
            config.sessionType = typeof(MySession);

            var server = new Server(config);
            server.AttachService<ChatService>();
            server.Start();

            while (true)
            {
                Console.WriteLine("running...");
                Thread.Sleep(1000);
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            NLog.Config.SimpleConfigurator.ConfigureForConsoleLogging(NLog.LogLevel.Debug);

            var config = Config.defaults;

            config.port = 9915;
            config.sessionType = typeof(MySession);
            config.marshalerType = typeof(JsonMarshaler);

            var server = new Server(config);
            server.AttachService<TestService>();
            server.Start();

            while (true)
            {
                //Console.WriteLine("running");
                Thread.Sleep(1000);
            }
        }
示例#5
0
        public Cluster(Server parent)
        {
            var config = (Config)parent.config.Clone();

            config.enableCluster = false;
            config.enableDB = false;
            config.port = config.clusterPort;
            config.sessionType = typeof(Cluster.Session);

            this.parent = parent;
            this.server = new Server(config);
            this.server.cluster = this;
            this.dispenser = new IdDispenser();

            this.peers = new Dictionary<int, Peer>();
            this.pendings = new Dictionary<int, RequestInfo>();

            int idx = 0;
            foreach(var peer in config.clusterPeers)
            {
                this.peers[idx++] = new Peer(this, peer.Item1, peer.Item2);
            }
        }
示例#6
0
 public MySession(Server server)
 {
     this.server = server;
 }
示例#7
0
 public Watcher(Server server)
 {
     this.server = server;
 }
示例#8
0
 public Worker(Server server)
 {
     this.server = server;
 }
示例#9
0
 public override void Invoke(Server server)
 {
     task.Start();
 }
示例#10
0
 public override void Invoke(Server server)
 {
     server.Enqueue(
         new Server.CallFuncEvent(callback));
 }
示例#11
0
 public abstract void Invoke(Server server);
 public WorkerSynchronizationContext(Server server)
 {
     this.server = server;
 }
示例#13
0
 public IoWorker(Server server)
 {
     this.server = server;
     this.obj = new object();
     this.pendingSessions = new ConcurrentDictionary<Session, byte>();
 }
示例#14
0
 static void Main(string[] args)
 {
     var config = Config.defaults;
     config.marshalerType = typeof(HttpMarshaler);
     Server server = new Server(config);
     server.AttachService<FooService>(new FooService());
     server.Start();
 }