Ejemplo n.º 1
0
        public Telehub FindTelehub(UUID regionID, ulong regionHandle)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["METHOD"]   = "findtelehub";
            sendData["REGIONID"] = regionID.ToString();

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(regionHandle.ToString(), "GridServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                                                                             m_ServerURI,
                                                                             reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            if (!replyData.ContainsKey("Result") || replyData.ContainsKey("Result") && replyData["Result"].ToString() != "Failure")
                            {
                                if (replyData.Count != 0)
                                {
                                    Telehub t = new Telehub();
                                    t.FromKVP(replyData);
                                    if (t.RegionID != UUID.Zero)
                                    {
                                        return(t);
                                    }
                                }
                            }
                        }
                        else
                        {
                            m_log.DebugFormat("[AuroraRemoteRegionConnector]: RemoveTelehub {0} received null response",
                                              regionID.ToString());
                        }
                    }
                }
                return(null);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e.ToString());
            }
            return(null);
        }
Ejemplo n.º 2
0
        public byte[] AddTelehub(Dictionary <string, object> request)
        {
            Telehub telehub = new Telehub();

            telehub.FromKVP(request);

            int RegionX, RegionY;

            Util.UlongToInts(m_regionHandle, out RegionX, out RegionY);
            GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, RegionX, RegionY);

            if (r != null)
            {
                telehub.RegionID = r.RegionID;
                TelehubConnector.AddTelehub(telehub, 0);
            }

            return(SuccessResult());
        }