Ejemplo n.º 1
0
        public client()
        {
            uuid          = System.Guid.NewGuid().ToString();
            timer         = new service.timerservice();
            modulemanager = new common.modulemanager();

            log.log.logMode = log.log.enLogMode.Release;

            var _process = new juggle.process();

            _gate_call_client = new module.gate_call_client();
            _gate_call_client.onconnect_gate_sucess += on_ack_connect_gate;
            _gate_call_client.onconnect_hub_sucess  += on_ack_connect_hub;
            _gate_call_client.onack_heartbeats      += on_ack_heartbeats;
            _gate_call_client.oncall_client         += on_call_client;
            _process.reg_module(_gate_call_client);
            _conn = new service.connectnetworkservice(_process);
            _conn.onChannelDisconnect += on_disconnect;

            _juggleservice = new service.juggleservice();
            _juggleservice.add_process(_process);

            _heartbeats           = 0;
            _is_enable_heartbeats = false;
            connect_state         = false;
        }
Ejemplo n.º 2
0
        public gm(string[] args)
        {
            Console.WriteLine("Enter gm name:");
            gm_name = Console.ReadLine();

            config.config _config = new config.config(args[0]);
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            juggle.process _gm_process = new juggle.process();
            _conn_center = new service.connectnetworkservice(_gm_process);

            var gm_ip   = _config.get_value_string("gm_ip");
            var gm_port = (short)_config.get_value_int("gm_port");

            _center_proxy = new center_proxy(_conn_center.connect(gm_ip, gm_port));
            _center_proxy.confirm_gm(gm_name);

            timer = new service.timerservice();

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_gm_process);
        }
Ejemplo n.º 3
0
        public client()
        {
            uuid          = System.Guid.NewGuid().ToString();
            timer         = new service.timerservice();
            modulemanager = new common.modulemanager();

            var _process = new juggle.process();

            _gate_call_client = new module.gate_call_client();
            _gate_call_client.onconnect_gate_sucess += on_ack_connect_gate;
            _gate_call_client.onconnect_hub_sucess  += on_ack_connect_hub;
            _gate_call_client.onack_heartbeats      += on_ack_heartbeats;
            _gate_call_client.oncall_client         += on_call_client;
            _process.reg_module(_gate_call_client);
            _conn = new service.connectnetworkservice(_process);
            _conn.onChannelDisconnect += on_disconnect;

            var _udp_process = new juggle.process();

            _gate_call_client_fast = new module.gate_call_client_fast();
            _gate_call_client_fast.onconfirm_refresh_udp_end_point += onconfirm_refresh_udp_end_point;
            _gate_call_client_fast.oncall_client += on_call_client;
            _udp_process.reg_module(_gate_call_client_fast);
            _udp_conn = new service.udpconnectnetworkservice(_udp_process);

            _juggleservice = new service.juggleservice();
            _juggleservice.add_process(_process);
            _juggleservice.add_process(_udp_process);

            _heartbeats           = 0;
            _is_enable_heartbeats = false;
        }
Ejemplo n.º 4
0
 public client_msg_handle(clientmanager _clientmanager_, logicmanager _logicmanager_, hubmanager _hubmanager_, service.timerservice _timerservice_)
 {
     _clientmanager = _clientmanager_;
     _logicmanager  = _logicmanager_;
     _hubmanager    = _hubmanager_;
     _timerservice  = _timerservice_;
 }
Ejemplo n.º 5
0
        public robot(String[] args)
        {
            config.config _config = new config.config(args[0]);
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            var log_level = _config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = _config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = _config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            Int64 robot_num = _config.get_value_int("robot_num");

            _ip   = _config.get_value_string("ip");
            _port = (short)_config.get_value_int("port");

            timer         = new service.timerservice();
            modulemanager = new common.modulemanager();

            _process          = new juggle.process();
            _gate_call_client = new module.gate_call_client();
            _gate_call_client.onconnect_gate_sucess  += on_ack_connect_gate;
            _gate_call_client.onack_get_logic        += on_ack_get_logic;
            _gate_call_client.onconnect_logic_sucess += on_ack_connect_logic;
            _gate_call_client.onconnect_hub_sucess   += on_ack_connect_hub;
            _gate_call_client.oncall_client          += on_call_client;
            _process.reg_module(_gate_call_client);

            _conn = new service.connectnetworkservice(_process);

            _juggleservice = new service.juggleservice();
            _juggleservice.add_process(_process);

            proxys = new Dictionary <juggle.Ichannel, client_proxy>();

            _max_robot_num = robot_num;
            _robot_num     = 0;
        }
Ejemplo n.º 6
0
        public center(string[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config.config _config = new config.config(args[0]);
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            _svrmanager   = new svrmanager();
            _logicmanager = new logicmanager();
            _hubmanager   = new hubmanager();

            juggle.process _center_process = new juggle.process();

            _svr_call_center = new module.center();
            _svr_msg_handle  = new svr_msg_handle(_svrmanager, _hubmanager, _logicmanager);
            _svr_call_center.onreg_server += _svr_msg_handle.reg_server;
            _center_process.reg_module(_svr_call_center);

            _logic_call_center = new module.logic_call_center();
            _logic_msg_handle  = new logic_svr_msg_handle(_svrmanager, _logicmanager);
            _logic_call_center.onreq_get_server_address += _logic_msg_handle.req_get_server_address;
            _center_process.reg_module(_logic_call_center);

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _accept_svr_service = new service.acceptnetworkservice(ip, port, _center_process);

            _gmmanager = new gmmanager();

            juggle.process _gm_process = new juggle.process();

            _gm_center                  = new module.gm_center();
            _gm_msg_handle              = new gm_msg_handle(_gmmanager, _svrmanager);
            _gm_center.onconfirm_gm    += _gm_msg_handle.confirm_gm;
            _gm_center.onclose_clutter += _gm_msg_handle.close_clutter;
            _gm_process.reg_module(_gm_center);

            var gm_ip   = _config.get_value_string("gm_ip");
            var gm_port = (short)_config.get_value_int("gm_port");

            _accept_gm_service = new service.acceptnetworkservice(gm_ip, gm_port, _gm_process);

            timer = new service.timerservice();

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_gm_process);
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            service.timerservice service = new service.timerservice();

            service.addweekdaytime(DayOfWeek.Monday, 17, 12, 0, (DateTime tim) => { Console.WriteLine("addweekdaytime test"); });
            service.addmonthdaytime(8, 7, 17, 16, 0, (DateTime tim) => { Console.WriteLine("addmonthdaytime test"); });
            service.addloopdaytime(17, 17, 0, (DateTime tim) => { Console.WriteLine("addloopdaytime test"); });
            service.addloopweekdaytime(DayOfWeek.Monday, 17, 18, 0, (DateTime tim) => { Console.WriteLine("addloopweekdaytime test"); });

            while (true)
            {
                service.poll();
            }
        }
Ejemplo n.º 8
0
        public client()
        {
            uuid          = System.Guid.NewGuid().ToString();
            timer         = new service.timerservice();
            modulemanager = new common.modulemanager();

            _process          = new juggle.process();
            _gate_call_client = new module.gate_call_client();
            _gate_call_client.onack_connect_server += on_ack_connect_server;
            _gate_call_client.oncall_client        += on_call_client;
            _process.reg_module(_gate_call_client);

            _conn = new service.connectnetworkservice(_process);

            _juggleservice = new service.juggleservice();
            _juggleservice.add_process(_process);
        }
Ejemplo n.º 9
0
        public client()
        {
            uuid = System.Guid.NewGuid().ToString();
            timer = new service.timerservice();
            modulemanager = new common.modulemanager();

            _process = new juggle.process();
            _gate_call_client = new module.gate_call_client();
            _gate_call_client.onack_connect_server += on_ack_connect_server;
            _gate_call_client.oncall_client += on_call_client;
            _process.reg_module(_gate_call_client);

            _conn = new service.connectnetworkservice(_process);

            _juggleservice = new service.juggleservice();
            _juggleservice.add_process(_process);
        }
Ejemplo n.º 10
0
        public robot(Int64 robot_num)
        {
            timer         = new service.timerservice();
            modulemanager = new common.modulemanager();

            _process          = new juggle.process();
            _gate_call_client = new module.gate_call_client();
            _gate_call_client.onconnect_gate_sucess  += on_ack_connect_gate;
            _gate_call_client.onack_get_logic        += on_ack_get_logic;
            _gate_call_client.onconnect_logic_sucess += on_ack_connect_logic;
            _gate_call_client.onconnect_hub_sucess   += on_ack_connect_hub;
            _gate_call_client.oncall_client          += on_call_client;
            _process.reg_module(_gate_call_client);

            _conn = new service.connectnetworkservice(_process);

            _juggleservice = new service.juggleservice();
            _juggleservice.add_process(_process);

            proxys = new Dictionary <juggle.Ichannel, client_proxy>();

            _max_robot_num = robot_num;
            _robot_num     = 0;
        }
Ejemplo n.º 11
0
        public dbproxy(String[] args)
        {
            is_busy = false;

            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            var log_level = _config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = _config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = _config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            closeHandle = new closehandle();

            var db_ip      = _config.get_value_string("db_ip");
            var db_port    = (short)_config.get_value_int("db_port");
            var db         = _config.get_value_string("db_name");
            var collection = _config.get_value_string("db_collection");

            _mongodbproxy = new mongodbproxy(db_ip, db_port, db, collection);

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _logic_call_dbproxy = new module.logic_call_dbproxy();
            _hub_call_dbproxy   = new module.hub_call_dbproxy();
            _process            = new juggle.process();
            _process.reg_module(_logic_call_dbproxy);
            _process.reg_module(_hub_call_dbproxy);
            _acceptnetworkservice = new service.acceptnetworkservice(ip, port, _process);

            _hubmanager                  = new hubmanager();
            _hub_msg_handle              = new hub_msg_handle(_hubmanager, _mongodbproxy);
            _hub_call_dbproxy.onreg_hub += _hub_msg_handle.reg_hub;
            _hub_call_dbproxy.oncreate_persisted_object += _hub_msg_handle.create_persisted_object;
            _hub_call_dbproxy.onupdata_persisted_object += _hub_msg_handle.updata_persisted_object;
            _hub_call_dbproxy.onget_object_info         += _hub_msg_handle.get_object_info;

            _logicmanager     = new logicmanager();
            _logic_msg_handle = new logic_msg_handle(_logicmanager, _mongodbproxy, closeHandle);
            _logic_call_dbproxy.onreg_logic               += _logic_msg_handle.reg_logic;
            _logic_call_dbproxy.onlogic_closed            += _logic_msg_handle.logic_closed;
            _logic_call_dbproxy.oncreate_persisted_object += _logic_msg_handle.create_persisted_object;
            _logic_call_dbproxy.onupdata_persisted_object += _logic_msg_handle.updata_persisted_object;
            _logic_call_dbproxy.onget_object_info         += _logic_msg_handle.get_object_info;

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_server = new module.center_call_server();
            _center_process     = new juggle.process();
            _center_process.reg_module(_center_call_server);
            _center_connectnetworkservice = new service.connectnetworkservice(_center_process);
            var _center_ch = _center_connectnetworkservice.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(_center_ch);
            _center_msg_handle = new center_msg_handle(closeHandle, _centerproxy);
            _center_call_server.onclose_server      += _center_msg_handle.close_server;
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_process);
            _juggle_service.add_process(_center_process);

            timer = new service.timerservice();

            _centerproxy.reg_dbproxy(ip, port, uuid);
        }
Ejemplo n.º 12
0
        public logic(String[] args)
        {
            is_busy = false;

            uuid = System.Guid.NewGuid().ToString();

            config.config _config = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            _closehandle = new closehandle();

            _modulemanager = new common.modulemanager();

            _dbproxy_call_logic = new module.dbproxy_call_logic();
            _dbproxy_process = new juggle.process();
            _dbproxy_process.reg_module(_dbproxy_call_logic);
            _dbproxy_connectnetworkservice = new service.connectnetworkservice(_dbproxy_process);
            dbproxy = new dbproxyproxy(_dbproxy_connectnetworkservice);
            _dbproxy_msg_handle = new dbproxy_msg_handle(dbproxy);
            _dbproxy_call_logic.onreg_logic_sucess += _dbproxy_msg_handle.reg_logic_sucess;
            _dbproxy_call_logic.onack_create_persisted_object += _dbproxy_msg_handle.ack_create_persisted_object;
            _dbproxy_call_logic.onack_updata_persisted_object += _dbproxy_msg_handle.ack_updata_persisted_object;
            _dbproxy_call_logic.onack_get_object_info += _dbproxy_msg_handle.ack_get_object_info;
            _dbproxy_call_logic.onack_get_object_info_end += _dbproxy_msg_handle.ack_get_object_info_end;

            _hub_call_logic = new module.hub_call_logic();
            _hub_process = new juggle.process();
            _hub_process.reg_module(_hub_call_logic);
            _hub_connectnetworkservice = new service.connectnetworkservice(_hub_process);
            hubs = new hubmanager(_hub_connectnetworkservice);
            _hub_msg_handle = new hub_msg_handle(_modulemanager);
            _hub_call_logic.onreg_logic_sucess_and_notify_hub_nominate += _hub_msg_handle.reg_logic_sucess_and_notify_hub_nominate;
            _hub_call_logic.onhub_call_logic_mothed += _hub_msg_handle.hub_call_logic_mothed;

            var ip = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");
            _logic_call_logic = new module.logic_call_logic();
            _logic_process = new juggle.process();
            _logic_connectnetworkservice = new service.connectnetworkservice(_logic_process);
            _logic_acceptnetworkservice = new service.acceptnetworkservice(ip, port, _logic_process);
            logics = new logicmanager(_logic_connectnetworkservice);
            _logic_msg_handle = new logic_msg_handle(_modulemanager);
            _logic_call_logic.onreg_logic += _logic_msg_handle.on_reg_logic;
            _logic_call_logic.onack_reg_logic += _logic_msg_handle.on_ack_reg_logic;
            _logic_call_logic.onlogic_call_logic_mothed += _logic_msg_handle.logic_call_logic_mothed;

            _gate_call_logic = new module.gate_call_logic();
            _gate_process = new juggle.process();
            _gate_process.reg_module(_gate_call_logic);
            _gate_connectnetworkservice = new service.connectnetworkservice(_gate_process);
            gates = new gatemanager(_gate_connectnetworkservice);
            _gate_msg_handle = new gate_msg_handle(_modulemanager);
            _gate_call_logic.onreg_logic_sucess += _gate_msg_handle.onreg_logic_sucess;
            _gate_call_logic.onclient_connect += _gate_msg_handle.client_connect;
            _gate_call_logic.onclient_disconnect += _gate_msg_handle.client_disconnect;
            _gate_call_logic.onclient_call_logic += _gate_msg_handle.client_call_logic;

            var center_ip = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");
            _center_call_server = new module.center_call_server();
            _center_call_logic = new module.center_call_logic();
            _center_process = new juggle.process();
            _center_process.reg_module(_center_call_server);
            _center_process.reg_module(_center_call_logic);
            _center_connectnetworkservice = new service.connectnetworkservice(_center_process);
            var _center_ch = _center_connectnetworkservice.connect(center_ip, center_port);
            _centerproxy = new centerproxy(_center_ch);
            _center_msg_handle = new center_msg_handle(_closehandle, _centerproxy);
            _center_call_server.onclose_server += _center_msg_handle.close_server;
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;
            _center_call_logic.ondistribute_server_address += _center_msg_handle.distribute_server_address;
            _center_call_logic.onack_get_server_address += _center_msg_handle.ack_get_server_address;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_dbproxy_process);
            _juggle_service.add_process(_hub_process);
            _juggle_service.add_process(_gate_process);
            _juggle_service.add_process(_logic_process);
            _juggle_service.add_process(_center_process);

            timer = new service.timerservice();

            _centerproxy.reg_logic(ip, port, uuid);
        }
Ejemplo n.º 13
0
        public hub(String[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            name = _config.get_value_string("hub_name");

            closeHandle = new closehandle();

            logics  = new logicmanager();
            modules = new common.modulemanager();

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _logic_msg_handle = new logic_msg_handle(modules, logics);
            _logic_call_hub   = new module.hub();
            _logic_call_hub.onlogic_call_hub_mothed += _logic_msg_handle.logic_call_hub_mothed;
            _logic_call_hub.onreg_logic             += _logic_msg_handle.reg_logic;
            var _logic_process = new juggle.process();

            _logic_process.reg_module(_logic_call_hub);
            _accept_logic_service = new service.acceptnetworkservice(ip, port, _logic_process);

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_hub    = new module.center_call_hub();
            _center_call_server = new module.center_call_server();
            var _center_process = new juggle.process();

            _center_process.reg_module(_center_call_hub);
            _center_process.reg_module(_center_call_server);
            _connect_center_service = new service.connectnetworkservice(_center_process);
            var center_ch = _connect_center_service.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(center_ch);
            _center_msg_handle = new center_msg_handle(this, closeHandle, _centerproxy);
            _center_call_server.onreg_server_sucess       += _center_msg_handle.reg_server_sucess;
            _center_call_server.onclose_server            += _center_msg_handle.close_server;
            _center_call_hub.ondistribute_dbproxy_address += _center_msg_handle.distribute_dbproxy_address;

            var _dbproxy_process = new juggle.process();

            _connect_dbproxy_service            = new service.connectnetworkservice(_dbproxy_process);
            _dbproxy_msg_handle                 = new dbproxy_msg_handle(dbproxy);
            _dbproxy_call_hub                   = new module.dbproxy_call_hub();
            _dbproxy_call_hub.onreg_hub_sucess += _dbproxy_msg_handle.reg_hub_sucess;
            _dbproxy_call_hub.onack_create_persisted_object += _dbproxy_msg_handle.ack_create_persisted_object;
            _dbproxy_call_hub.onack_updata_persisted_object += _dbproxy_msg_handle.ack_updata_persisted_object;
            _dbproxy_call_hub.onack_get_object_info         += _dbproxy_msg_handle.ack_get_object_info;
            _dbproxy_call_hub.onack_get_object_info_end     += _dbproxy_msg_handle.ack_get_object_info_end;
            _dbproxy_process.reg_module(_dbproxy_call_hub);

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_logic_process);
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_dbproxy_process);

            timer = new service.timerservice();

            _centerproxy.reg_hub(ip, port, uuid);
        }
Ejemplo n.º 14
0
        public logic(String[] args)
        {
            is_busy = false;

            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            var log_level = _config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = _config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = _config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            closeHandle = new closehandle();

            modules = new common.modulemanager();

            _dbproxy_call_logic = new module.dbproxy_call_logic();
            _dbproxy_process    = new juggle.process();
            _dbproxy_process.reg_module(_dbproxy_call_logic);
            _dbproxy_connectnetworkservice = new service.connectnetworkservice(_dbproxy_process);
            dbproxy             = new dbproxyproxy(_dbproxy_connectnetworkservice);
            _dbproxy_msg_handle = new dbproxy_msg_handle(dbproxy, this);
            _dbproxy_call_logic.onreg_logic_sucess            += _dbproxy_msg_handle.reg_logic_sucess;
            _dbproxy_call_logic.onack_create_persisted_object += _dbproxy_msg_handle.ack_create_persisted_object;
            _dbproxy_call_logic.onack_updata_persisted_object += _dbproxy_msg_handle.ack_updata_persisted_object;
            _dbproxy_call_logic.onack_get_object_info         += _dbproxy_msg_handle.ack_get_object_info;
            _dbproxy_call_logic.onack_get_object_info_end     += _dbproxy_msg_handle.ack_get_object_info_end;

            _hub_call_logic = new module.hub_call_logic();
            _hub_process    = new juggle.process();
            _hub_process.reg_module(_hub_call_logic);
            _hub_connectnetworkservice = new service.connectnetworkservice(_hub_process);
            hubs            = new hubmanager(_hub_connectnetworkservice);
            _hub_msg_handle = new hub_msg_handle(modules);
            _hub_call_logic.onreg_logic_sucess_and_notify_hub_nominate += _hub_msg_handle.reg_logic_sucess_and_notify_hub_nominate;
            _hub_call_logic.onhub_call_logic_mothed += _hub_msg_handle.hub_call_logic_mothed;

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _logic_call_logic            = new module.logic_call_logic();
            _logic_process               = new juggle.process();
            _logic_connectnetworkservice = new service.connectnetworkservice(_logic_process);
            _logic_acceptnetworkservice  = new service.acceptnetworkservice(ip, port, _logic_process);
            logics                                       = new logicmanager(_logic_connectnetworkservice);
            _logic_msg_handle                            = new logic_msg_handle(modules);
            _logic_call_logic.onreg_logic               += _logic_msg_handle.on_reg_logic;
            _logic_call_logic.onack_reg_logic           += _logic_msg_handle.on_ack_reg_logic;
            _logic_call_logic.onlogic_call_logic_mothed += _logic_msg_handle.logic_call_logic_mothed;

            _gate_call_logic = new module.gate_call_logic();
            _gate_process    = new juggle.process();
            _gate_process.reg_module(_gate_call_logic);
            _gate_connectnetworkservice = new service.connectnetworkservice(_gate_process);
            gates            = new gatemanager(_gate_connectnetworkservice);
            _gate_msg_handle = new gate_msg_handle(modules);
            _gate_call_logic.onreg_logic_sucess  += _gate_msg_handle.onreg_logic_sucess;
            _gate_call_logic.onclient_get_logic  += _gate_msg_handle.client_get_logic;
            _gate_call_logic.onclient_connect    += _gate_msg_handle.client_connect;
            _gate_call_logic.onclient_disconnect += _gate_msg_handle.client_disconnect;
            _gate_call_logic.onclient_exception  += _gate_msg_handle.client_exception;
            _gate_call_logic.onclient_call_logic += _gate_msg_handle.client_call_logic;

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_server = new module.center_call_server();
            _center_call_logic  = new module.center_call_logic();
            _center_process     = new juggle.process();
            _center_process.reg_module(_center_call_server);
            _center_process.reg_module(_center_call_logic);
            _center_connectnetworkservice = new service.connectnetworkservice(_center_process);
            var _center_ch = _center_connectnetworkservice.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(_center_ch);
            _center_msg_handle = new center_msg_handle(closeHandle, _centerproxy);
            _center_call_server.onclose_server             += _center_msg_handle.close_server;
            _center_call_server.onreg_server_sucess        += _center_msg_handle.reg_server_sucess;
            _center_call_logic.ondistribute_server_address += _center_msg_handle.distribute_server_address;
            _center_call_logic.onack_get_server_address    += _center_msg_handle.ack_get_server_address;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_dbproxy_process);
            _juggle_service.add_process(_hub_process);
            _juggle_service.add_process(_gate_process);
            _juggle_service.add_process(_logic_process);
            _juggle_service.add_process(_center_process);

            timer = new service.timerservice();

            _centerproxy.reg_logic(ip, port, uuid);
        }
Ejemplo n.º 15
0
        public gate(String[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            var log_level = _config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = _config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = _config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            closeHandle = new closehandle();

            enable_heartbeats = _config.get_value_bool("heartbeats");

            timer       = new service.timerservice();
            _hubmanager = new hubmanager();
            clients     = new clientmanager();

            _client_msg_handle = new client_msg_handle(clients, _hubmanager, timer);
            _client_call_gate  = new module.client_call_gate();
            _client_call_gate.onconnect_server          += _client_msg_handle.connect_server;
            _client_call_gate.oncancle_server           += _client_msg_handle.cancle_server;
            _client_call_gate.onconnect_hub             += _client_msg_handle.connect_hub;
            _client_call_gate.ondisconnect_hub          += _client_msg_handle.disconnect_hub;
            _client_call_gate.onforward_client_call_hub += _client_msg_handle.forward_client_call_hub;
            _client_call_gate.onheartbeats += _client_msg_handle.heartbeats;
            var _client_process = new juggle.process();

            _client_process.reg_module(_client_call_gate);

            var outside_ip   = _config.get_value_string("outside_ip");
            var outside_port = (short)_config.get_value_int("outside_port");

            _accept_client_service = new service.acceptnetworkservice(outside_ip, outside_port, _client_process);
            _accept_client_service.onChannelDisconnect += onClientDissconnect;

            _hub_msg_handle                                  = new hub_msg_handle(_hubmanager, clients);
            _hub_call_gate                                   = new module.hub_call_gate();
            _hub_call_gate.onreg_hub                        += _hub_msg_handle.reg_hub;
            _hub_call_gate.onconnect_sucess                 += _hub_msg_handle.connect_sucess;
            _hub_call_gate.ondisconnect_client              += _hub_msg_handle.disconnect_client;
            _hub_call_gate.onforward_hub_call_client        += _hub_msg_handle.forward_hub_call_client;
            _hub_call_gate.onforward_hub_call_global_client += _hub_msg_handle.forward_hub_call_global_client;
            _hub_call_gate.onforward_hub_call_group_client  += _hub_msg_handle.forward_hub_call_group_client;

            var _logic_hub_process = new juggle.process();

            _logic_hub_process.reg_module(_hub_call_gate);
            var inside_ip   = _config.get_value_string("inside_ip");
            var inside_port = (short)_config.get_value_int("inside_port");

            _accept_logic_hub_service = new service.acceptnetworkservice(inside_ip, inside_port, _logic_hub_process);

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_server = new module.center_call_server();
            var _center_process = new juggle.process();

            _center_process.reg_module(_center_call_server);
            _connect_center_service = new service.connectnetworkservice(_center_process);
            var center_ch = _connect_center_service.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(center_ch);
            _center_msg_handle = new center_msg_handle(closeHandle, _centerproxy);
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;
            _center_call_server.onclose_server      += _center_msg_handle.close_server;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_logic_hub_process);
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_client_process);

            _centerproxy.reg_gate(inside_ip, inside_port, uuid);

            if (enable_heartbeats)
            {
                timer.addticktime(60 * 1000, clients.tick_client);
            }
        }
Ejemplo n.º 16
0
        public hub(String[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config = new config.config(args[0]);
            config.config _center_config = config.get_value_dict("center");
            if (args.Length > 1)
            {
                config = config.get_value_dict(args[1]);
            }

            var log_level = config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            name = config.get_value_string("hub_name");

            closeHandle = new closehandle();
            modules     = new common.modulemanager();

            var _hub_logic_process = new juggle.process();

            _connect_hub_service = new service.connectnetworkservice(_hub_logic_process);

            hubs = new hubmanager();

            _hub_msg_handle                      = new hub_msg_handle(modules, hubs);
            _hub_call_hub                        = new module.hub_call_hub();
            _hub_call_hub.onreg_hub             += _hub_msg_handle.reg_hub;
            _hub_call_hub.onreg_hub_sucess      += _hub_msg_handle.reg_hub_sucess;
            _hub_call_hub.onhub_call_hub_mothed += _hub_msg_handle.hub_call_hub_mothed;
            _hub_logic_process.reg_module(_hub_call_hub);

            var ip   = config.get_value_string("ip");
            var port = (short)config.get_value_int("port");

            _accept_logic_service = new service.acceptnetworkservice(ip, port, _hub_logic_process);

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_hub    = new module.center_call_hub();
            _center_call_server = new module.center_call_server();
            var _center_process = new juggle.process();

            _center_process.reg_module(_center_call_hub);
            _center_process.reg_module(_center_call_server);
            _connect_center_service = new service.connectnetworkservice(_center_process);
            var center_ch = _connect_center_service.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(center_ch);
            _center_msg_handle = new center_msg_handle(this, closeHandle, _centerproxy);
            _center_call_server.onreg_server_sucess      += _center_msg_handle.reg_server_sucess;
            _center_call_server.onclose_server           += _center_msg_handle.close_server;
            _center_call_hub.ondistribute_server_address += _center_msg_handle.distribute_server_address;
            _center_call_hub.onreload += onReload_event;

            var _dbproxy_process = new juggle.process();

            _connect_dbproxy_service            = new service.connectnetworkservice(_dbproxy_process);
            _dbproxy_msg_handle                 = new dbproxy_msg_handle(this);
            _dbproxy_call_hub                   = new module.dbproxy_call_hub();
            _dbproxy_call_hub.onreg_hub_sucess += _dbproxy_msg_handle.reg_hub_sucess;
            _dbproxy_call_hub.onack_create_persisted_object += _dbproxy_msg_handle.ack_create_persisted_object;
            _dbproxy_call_hub.onack_updata_persisted_object += _dbproxy_msg_handle.ack_updata_persisted_object;
            _dbproxy_call_hub.onack_get_object_count        += _dbproxy_msg_handle.ack_get_object_count;
            _dbproxy_call_hub.onack_get_object_info         += _dbproxy_msg_handle.ack_get_object_info;
            _dbproxy_call_hub.onack_get_object_info_end     += _dbproxy_msg_handle.ack_get_object_info_end;
            _dbproxy_call_hub.onack_remove_object           += _dbproxy_msg_handle.ack_remove_object;

            _dbproxy_process.reg_module(_dbproxy_call_hub);

            juggle.process _gate_process = new juggle.process();
            _gate_msg_handle = new gate_msg_handle(modules);
            _gate_call_hub   = new module.gate_call_hub();
            _gate_call_hub.onreg_hub_sucess    += _gate_msg_handle.reg_hub_sucess;
            _gate_call_hub.onclient_connect    += _gate_msg_handle.client_connect;
            _gate_call_hub.onclient_disconnect += _gate_msg_handle.client_disconnect;
            _gate_call_hub.onclient_exception  += _gate_msg_handle.client_exception;
            _gate_call_hub.onclient_call_hub   += _gate_msg_handle.client_call_hub;
            _gate_process.reg_module(_gate_call_hub);
            _connect_gate_servcie = new service.connectnetworkservice(_gate_process);
            gates = new gatemanager(_connect_gate_servcie);

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_hub_logic_process);
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_dbproxy_process);
            _juggle_service.add_process(_gate_process);

            timer = new service.timerservice();

            _centerproxy.reg_hub(ip, port, uuid);
        }
Ejemplo n.º 17
0
        public center(string[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config.config _config = new config.config(args[0]);
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            var log_level = _config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = _config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = _config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            _svrmanager   = new svrmanager();
            _logicmanager = new logicmanager();
            _hubmanager   = new hubmanager();

            juggle.process _center_process = new juggle.process();

            _svr_call_center = new module.center();
            _svr_msg_handle  = new svr_msg_handle(_svrmanager, _hubmanager, _logicmanager);
            _svr_call_center.onreg_server += _svr_msg_handle.reg_server;
            _center_process.reg_module(_svr_call_center);

            _logic_call_center = new module.logic_call_center();
            _logic_msg_handle  = new logic_svr_msg_handle(_svrmanager, _logicmanager);
            _logic_call_center.onreq_get_server_address += _logic_msg_handle.req_get_server_address;
            _center_process.reg_module(_logic_call_center);

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _accept_svr_service = new service.acceptnetworkservice(ip, port, _center_process);

            _gmmanager = new gmmanager();

            juggle.process _gm_process = new juggle.process();

            _gm_center                  = new module.gm_center();
            _gm_msg_handle              = new gm_msg_handle(_gmmanager, _svrmanager);
            _gm_center.onconfirm_gm    += _gm_msg_handle.confirm_gm;
            _gm_center.onclose_clutter += _gm_msg_handle.close_clutter;
            _gm_process.reg_module(_gm_center);

            var gm_ip   = _config.get_value_string("gm_ip");
            var gm_port = (short)_config.get_value_int("gm_port");

            _accept_gm_service = new service.acceptnetworkservice(gm_ip, gm_port, _gm_process);

            timer = new service.timerservice();

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_gm_process);
        }
Ejemplo n.º 18
0
        public hub(String[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config.config _config = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            name = _config.get_value_string("hub_name");

            _closehandle = new closehandle();

            logics = new logicmanager();
            _modulemanager = new common.modulemanager();

            var ip = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");
            _logic_msg_handle = new logic_msg_handle(_modulemanager, logics);
            _logic_call_hub = new module.hub();
            _logic_call_hub.onlogic_call_hub_mothed += _logic_msg_handle.logic_call_hub_mothed;
            _logic_call_hub.onreg_logic += _logic_msg_handle.reg_logic;
            var _logic_process = new juggle.process();
            _logic_process.reg_module(_logic_call_hub);
            _accept_logic_service = new service.acceptnetworkservice(ip, port, _logic_process);

            var center_ip = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");
            _center_call_hub = new module.center_call_hub();
            _center_call_server = new module.center_call_server();
            var _center_process = new juggle.process();
            _center_process.reg_module(_center_call_hub);
            _center_process.reg_module(_center_call_server);
            _connect_center_service = new service.connectnetworkservice(_center_process);
            var center_ch = _connect_center_service.connect(center_ip, center_port);
            _centerproxy = new centerproxy(center_ch);
            _center_msg_handle = new center_msg_handle(this, _closehandle, _centerproxy);
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;
            _center_call_server.onclose_server += _center_msg_handle.close_server;
            _center_call_hub.ondistribute_dbproxy_address += _center_msg_handle.distribute_dbproxy_address;

            var _dbproxy_process = new juggle.process();
            _connect_dbproxy_service = new service.connectnetworkservice(_dbproxy_process);
            _dbproxy_msg_handle = new dbproxy_msg_handle(dbproxy);
            _dbproxy_call_hub = new module.dbproxy_call_hub();
            _dbproxy_call_hub.onreg_hub_sucess += _dbproxy_msg_handle.reg_hub_sucess;
            _dbproxy_call_hub.onack_create_persisted_object += _dbproxy_msg_handle.ack_create_persisted_object;
            _dbproxy_call_hub.onack_updata_persisted_object += _dbproxy_msg_handle.ack_updata_persisted_object;
            _dbproxy_call_hub.onack_get_object_info += _dbproxy_msg_handle.ack_get_object_info;
            _dbproxy_call_hub.onack_get_object_info_end += _dbproxy_msg_handle.ack_get_object_info_end;
            _dbproxy_process.reg_module(_dbproxy_call_hub);

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_logic_process);
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_dbproxy_process);

            timer = new service.timerservice();

            _centerproxy.reg_hub(ip, port, uuid);
        }
Ejemplo n.º 19
0
        public dbproxy(String[] args)
        {
            is_busy = false;

            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            var log_level = _config.get_value_string("log_level");

            if (log_level == "debug")
            {
                log.log.logMode = log.log.enLogMode.Debug;
            }
            else if (log_level == "release")
            {
                log.log.logMode = log.log.enLogMode.Release;
            }
            var log_file = _config.get_value_string("log_file");

            log.log.logFile = log_file;
            var log_dir = _config.get_value_string("log_dir");

            log.log.logPath = log_dir;
            {
                if (!System.IO.Directory.Exists(log_dir))
                {
                    System.IO.Directory.CreateDirectory(log_dir);
                }
            }

            closeHandle = new closehandle();

            _dbevent = new dbevent();
            _dbevent.start();

            if (_config.has_key("db_ip") && _config.has_key("db_port"))
            {
                var db_ip   = _config.get_value_string("db_ip");
                var db_port = (short)_config.get_value_int("db_port");

                _mongodbproxy = new mongodbproxy(db_ip, db_port);
            }
            else if (_config.has_key("db_url"))
            {
                _mongodbproxy = new mongodbproxy(_config.get_value_string("db_url"));
            }

            if (_config.has_key("index"))
            {
                var _index_config = _config.get_value_list("index");
                for (int i = 0; i < _index_config.get_list_size(); i++)
                {
                    var index      = _index_config.get_list_dict(i);
                    var db         = index.get_value_string("db");
                    var collection = index.get_value_string("collection");
                    var key        = index.get_value_string("key");
                    var is_unique  = index.get_value_bool("is_unique");
                    _mongodbproxy.create_index(db, collection, key, is_unique);
                }
            }

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _hub_call_dbproxy = new module.hub_call_dbproxy();
            _process          = new juggle.process();
            _process.reg_module(_hub_call_dbproxy);
            _acceptnetworkservice = new service.acceptnetworkservice(ip, port, _process);

            _hubmanager                  = new hubmanager();
            _hub_msg_handle              = new hub_msg_handle(_hubmanager, _mongodbproxy);
            _hub_call_dbproxy.onreg_hub += _hub_msg_handle.reg_hub;
            _hub_call_dbproxy.oncreate_persisted_object += _hub_msg_handle.create_persisted_object;
            _hub_call_dbproxy.onupdata_persisted_object += _hub_msg_handle.updata_persisted_object;
            _hub_call_dbproxy.onget_object_count        += _hub_msg_handle.get_object_count;
            _hub_call_dbproxy.onget_object_info         += _hub_msg_handle.get_object_info;
            _hub_call_dbproxy.onremove_object           += _hub_msg_handle.remove_object;

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_server = new module.center_call_server();
            _center_process     = new juggle.process();
            _center_process.reg_module(_center_call_server);
            _center_connectnetworkservice = new service.connectnetworkservice(_center_process);
            var _center_ch = _center_connectnetworkservice.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(_center_ch);
            _center_msg_handle = new center_msg_handle(closeHandle, _centerproxy);
            _center_call_server.onclose_server      += _center_msg_handle.close_server;
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_process);
            _juggle_service.add_process(_center_process);

            timer = new service.timerservice();

            _centerproxy.reg_dbproxy(ip, port, uuid);
        }
Ejemplo n.º 20
0
        public gate(String[] args)
        {
            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            closeHandle = new closehandle();

            timer              = new service.timerservice();
            _logicmanager      = new logicmanager();
            _clientmanager     = new clientmanager();
            _client_msg_handle = new client_msg_handle(_clientmanager, _logicmanager, timer);
            _client_call_gate  = new module.client_call_gate();
            _client_call_gate.onconnect_server            += _client_msg_handle.connect_server;
            _client_call_gate.oncancle_server             += _client_msg_handle.cancle_server;
            _client_call_gate.onforward_client_call_logic += _client_msg_handle.forward_client_call_logic;
            _client_call_gate.onheartbeats += _client_msg_handle.heartbeats;
            var _client_process = new juggle.process();

            _client_process.reg_module(_client_call_gate);


            var outside_ip   = _config.get_value_string("outside_ip");
            var outside_port = (short)_config.get_value_int("outside_port");

            _accept_client_service = new service.acceptnetworkservice(outside_ip, outside_port, _client_process);

            _logic_msg_handle             = new logic_msg_handle(_logicmanager, _clientmanager);
            _logic_call_gate              = new module.logic_call_gate();
            _logic_call_gate.onreg_logic += _logic_msg_handle.reg_logic;
            _logic_call_gate.onack_client_connect_server        += _logic_msg_handle.ack_client_connect_server;
            _logic_call_gate.onforward_logic_call_client        += _logic_msg_handle.forward_logic_call_client;
            _logic_call_gate.onforward_logic_call_global_client += _logic_msg_handle.forward_logic_call_global_client;
            _logic_call_gate.onforward_logic_call_group_client  += _logic_msg_handle.forward_logic_call_group_client;

            _hubmanager               = new hubmanager();
            _hub_msg_handle           = new hub_msg_handle(_hubmanager, _clientmanager);
            _hub_call_gate            = new module.hub_call_gate();
            _hub_call_gate.onreg_hub += _hub_msg_handle.reg_hub;
            //_hub_call_gate.onforward_hub_call_client += _hub_msg_handle.forward_hub_call_client;
            _hub_call_gate.onforward_hub_call_global_client += _hub_msg_handle.forward_hub_call_global_client;
            _hub_call_gate.onforward_hub_call_group_client  += _hub_msg_handle.forward_hub_call_group_client;

            var _logic_hub_process = new juggle.process();

            _logic_hub_process.reg_module(_logic_call_gate);
            _logic_hub_process.reg_module(_hub_call_gate);
            var inside_ip   = _config.get_value_string("inside_ip");
            var inside_port = (short)_config.get_value_int("inside_port");

            _accept_logic_hub_service = new service.acceptnetworkservice(inside_ip, inside_port, _logic_hub_process);

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_server = new module.center_call_server();
            var _center_process = new juggle.process();

            _center_process.reg_module(_center_call_server);
            _connect_center_service = new service.connectnetworkservice(_center_process);
            var center_ch = _connect_center_service.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(center_ch);
            _center_msg_handle = new center_msg_handle(closeHandle, _centerproxy);
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;
            _center_call_server.onclose_server      += _center_msg_handle.close_server;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_logic_hub_process);
            _juggle_service.add_process(_center_process);
            _juggle_service.add_process(_client_process);

            _centerproxy.reg_gate(inside_ip, inside_port, uuid);
        }
Ejemplo n.º 21
0
        public dbproxy(String[] args)
        {
            is_busy = false;

            uuid = System.Guid.NewGuid().ToString();

            config.config _config        = new config.config(args[0]);
            config.config _center_config = _config.get_value_dict("center");
            if (args.Length > 1)
            {
                _config = _config.get_value_dict(args[1]);
            }

            closeHandle = new closehandle();

            var db_ip      = _config.get_value_string("db_ip");
            var db_port    = (short)_config.get_value_int("db_port");
            var db         = _config.get_value_string("db_name");
            var collection = _config.get_value_string("db_collection");

            _mongodbproxy = new mongodbproxy(db_ip, db_port, db, collection);

            var ip   = _config.get_value_string("ip");
            var port = (short)_config.get_value_int("port");

            _hub_call_dbproxy = new module.hub_call_dbproxy();
            _hub_process      = new juggle.process();
            _hub_process.reg_module(_hub_call_dbproxy);
            _hub_acceptnetworkservice = new service.acceptnetworkservice(ip, port, _hub_process);
            _hubmanager                  = new hubmanager();
            _hub_msg_handle              = new hub_msg_handle(_hubmanager, _mongodbproxy);
            _hub_call_dbproxy.onreg_hub += _hub_msg_handle.reg_hub;
            _hub_call_dbproxy.oncreate_persisted_object += _hub_msg_handle.create_persisted_object;
            _hub_call_dbproxy.onupdata_persisted_object += _hub_msg_handle.updata_persisted_object;
            _hub_call_dbproxy.onget_object_info         += _hub_msg_handle.get_object_info;

            _logic_call_dbproxy         = new module.logic_call_dbproxy();
            _logic_process              = new juggle.process();
            _logic_acceptnetworkservice = new service.acceptnetworkservice(ip, port, _logic_process);
            _logicmanager     = new logicmanager();
            _logic_msg_handle = new logic_msg_handle(_logicmanager, _mongodbproxy, closeHandle);
            _logic_call_dbproxy.onreg_logic               += _logic_msg_handle.reg_logic;
            _logic_call_dbproxy.onlogic_closed            += _logic_msg_handle.logic_closed;
            _logic_call_dbproxy.oncreate_persisted_object += _logic_msg_handle.create_persisted_object;
            _logic_call_dbproxy.onupdata_persisted_object += _logic_msg_handle.updata_persisted_object;
            _logic_call_dbproxy.onget_object_info         += _logic_msg_handle.get_object_info;

            var center_ip   = _center_config.get_value_string("ip");
            var center_port = (short)_center_config.get_value_int("port");

            _center_call_server = new module.center_call_server();
            _center_process     = new juggle.process();
            _center_process.reg_module(_center_call_server);
            _center_connectnetworkservice = new service.connectnetworkservice(_center_process);
            var _center_ch = _center_connectnetworkservice.connect(center_ip, center_port);

            _centerproxy       = new centerproxy(_center_ch);
            _center_msg_handle = new center_msg_handle(closeHandle, _centerproxy);
            _center_call_server.onclose_server      += _center_msg_handle.close_server;
            _center_call_server.onreg_server_sucess += _center_msg_handle.reg_server_sucess;

            _juggle_service = new service.juggleservice();
            _juggle_service.add_process(_hub_process);
            _juggle_service.add_process(_logic_process);
            _juggle_service.add_process(_center_process);

            timer = new service.timerservice();

            _centerproxy.reg_dbproxy(ip, port, uuid);
        }