internal Scheduler(Server server) { this.server = server; timers = new List<Timer>(); lastTick = Environment.TickCount; pendingTimers = new ConcurrentQueue<Timer>(); }
public void Initialize() { server = new Server(Config.defaults); server.Start(); server.Wait(); Console.WriteLine("Initialize"); }
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); } }
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); } }
public MySession(Server server) { this.server = server; }
public Watcher(Server server) { this.server = server; }
public Worker(Server server) { this.server = server; }
public override void Invoke(Server server) { task.Start(); }
public override void Invoke(Server server) { server.Enqueue( new Server.CallFuncEvent(callback)); }
public abstract void Invoke(Server server);
public WorkerSynchronizationContext(Server server) { this.server = server; }
public IoWorker(Server server) { this.server = server; this.obj = new object(); this.pendingSessions = new ConcurrentDictionary<Session, byte>(); }
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(); }