Esempio n. 1
0
        public void OnHttpMessage(Session session, int opcode, object msg)
        {
            HttpMessage httpMessage = msg as HttpMessage;

            if (httpMessage == null || httpMessage.request == null || networkHttp == null ||
                httpMessage.request.LocalEndPoint.ToString() != networkHttp.ipEndPoint.ToString())
            {
                return;
            }
            switch (httpMessage.map["cmd"].ToLower())
            {
            case "submit":
                OnSubmit(httpMessage);
                break;

            case "registerpool":
                HttpPoolRelay.OnRegisterPool(httpMessage);
                break;

            case "getmcblock":
                HttpPoolRelay.OnGetMcBlock(httpMessage);
                break;

            default:
                break;
            }
            //TestOnSubmit(httpMessage);
        }
        public override void Start()
        {
            httpPoolRelay = Entity.Root.GetComponent <HttpPoolRelay>();

            System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(ThreadRun));
            thread.IsBackground = true;//设置为后台线程
            thread.Priority     = System.Threading.ThreadPriority.Normal;
            thread.Start(this);
        }