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

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

            Console.WriteLine("Initialize");
        }
Example #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);
            }
        }
        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);
            }
        }
Example #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);
            }
        }
Example #6
0
 public MySession(Server server)
 {
     this.server = server;
 }
Example #7
0
 public Watcher(Server server)
 {
     this.server = server;
 }
Example #8
0
 public Worker(Server server)
 {
     this.server = server;
 }
Example #9
0
 public override void Invoke(Server server)
 {
     task.Start();
 }
Example #10
0
 public override void Invoke(Server server)
 {
     server.Enqueue(
         new Server.CallFuncEvent(callback));
 }
Example #11
0
 public abstract void Invoke(Server server);
 public WorkerSynchronizationContext(Server server)
 {
     this.server = server;
 }
Example #13
0
 public IoWorker(Server server)
 {
     this.server = server;
     this.obj = new object();
     this.pendingSessions = new ConcurrentDictionary<Session, byte>();
 }
Example #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();
 }