public void ChannelReceiveMessage(ServerBase server, PacketRecieveMessagerArgs e) { try { HttpHeader hader = (HttpHeader)e.Message; Properties ps = new Properties(); ps.FromHeaders(hader.Properties); switch (hader.RequestType) { case Protocol.COMMAND_GET: OnGet(e.Channel, hader.Url, ps); break; case Protocol.COMMAND_GETINFO: OnGetInfo(e.Channel, hader.Url, ps); break; case Protocol.COMMAND_REGISTER: OnRegister(e.Channel, hader.Url, ps); break; default: break; } } catch (Exception e_) { Utils.Error<TrackerServer>("<{0}> message process error {1}", e.Message, e_.Message); HttpHeader header = Protocol.GetResponse(new Properties()); header.Action = "500 " + e_.Message; e.Channel.Send(header); } }
public AppHost GetHost(IProperties properties =null) { if(properties ==null) { properties = new Properties(); } HttpExtend.HttpHeader request = Protocol.Get(mAppName, properties); HttpExtend.HttpHeader result = mNode.Send<HttpExtend.HttpHeader>(request); if (result.RequestType == "500") throw new Exception(result.ActionDetail); return new AppHost { Host=result["Host"],Port=int.Parse(result["Port"]) }; }