Example #1
0
pid_file = option.pid_file  #pid文件名
if pid_file:
    pid_file = dirname(abspath(__file__)) + '/' + pid_file
    with open(pid_file, 'wb') as fd:
        fd.write(str(os.getpid()))

#python gateway.py 8084 2 开启2服  - 8084端口  数据库 gamesg2 (可省)
#python gateway.py 8086 3 开启3服  - 8086端口  数据库 gamesg3 (未开)

from sgLib.setting import Setting
if args:
    port = args[0]
    Setting.setGatewayPort(port)
    if len(args) >= 2:
        Setting.setDatabase('gamesg%s' % args[1])
else:
    port = Cfg.CFG_GATEWAYSERV_PORT


class Service(object):
    def __init__(self):
        #self.validate = Validate()
        self.Clients = {}  #所有用户信息库
        Gcore.objCfg.loadAllCfg()  #读取所有配置
        Gcore.IsServer = True  #定义为服务器核心

        Gcore.startNotice()  #开启公告自动发布协程

    def handle(self, channel, request):
Example #2
0
                                    help='保存该进程的PID的文件')
option, args = parser.parse_args()

pid_file = option.pid_file
if pid_file:
    pid_file = abspath( __file__ )+'.pid'
    with open(pid_file, 'wb') as fd:
        fd.write(str(os.getpid()))

from sgLib.setting import Setting

if args:
    port = args[0]
    Setting.setGatewayPort(port)
    if len(args) >= 2:
        Setting.setDatabase('gamesg%s'%args[1])
else:
    port = Cfg.CFG_GATEWAYSERV_PORT



#python gateway.py 8084 2 开启2服  - 8084端口  数据库 gamesg2 (可省)
#python gateway.py 8086 3 开启3服  - 8086端口  数据库 gamesg3 (未开)


#== START CONTENT START ==
import time
import gevent.pool
import message

Example #3
0
import os
pid = os.getpid()
pidfile = dirname( abspath( __file__ ) )+'/gateway.pid'
open(pidfile,'w').write(str(pid))

#python gateway.py 8084 2 开启2服  - 8084端口  数据库 gamesg2 (可省)
#python gateway.py 8086 3 开启3服  - 8086端口  数据库 gamesg3 (未开)
from sgLib.setting import Setting
try:
    if sys.argv:
        port = int(sys.argv[1])
        Setting.setGatewayPort(port)
        if len(sys.argv)>2:
            database = 'gamesg%s'%sys.argv[2]
            Setting.setDatabase(database)
except Exception, e:
    print e
    pass

#== START CONTENT START ==
import time
import gevent.pool
import message

import sgCfg.config as Cfg
import sgLib.common as comm

from sgLib.core import Gcore
from sgLib.proManager import proManager
from CLogin import Login
Example #4
0
pid_file = option.pid_file  # pid文件名
if pid_file:
    pid_file = dirname(abspath(__file__)) + "/" + pid_file
    with open(pid_file, "wb") as fd:
        fd.write(str(os.getpid()))

# python gateway.py 8084 2 开启2服  - 8084端口  数据库 gamesg2 (可省)
# python gateway.py 8086 3 开启3服  - 8086端口  数据库 gamesg3 (未开)

from sgLib.setting import Setting

if args:
    port = args[0]
    Setting.setGatewayPort(port)
    if len(args) >= 2:
        Setting.setDatabase("gamesg%s" % args[1])
else:
    port = Cfg.CFG_GATEWAYSERV_PORT


class Service(object):
    def __init__(self):
        # self.validate = Validate()
        self.Clients = {}  # 所有用户信息库
        Gcore.objCfg.loadAllCfg()  # 读取所有配置
        Gcore.IsServer = True  # 定义为服务器核心

        Gcore.startNotice()  # 开启公告自动发布协程

    def handle(self, channel, request):