public byte[] AddTelehub(Dictionary<string, object> request)
        {
            Telehub telehub = new Telehub();
            telehub.FromKVP(request);

            int RegionX, RegionY;
            ulong handle;
            if (ulong.TryParse(m_SessionID, out handle))
            {
                Util.UlongToInts(handle, 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();
        }
        public byte[] AddTelehub(Dictionary<string, object> request)
        {
            Telehub telehub = new Telehub();
            telehub.FromKVP(request);
            UUID SessionID = UUID.Parse(request["SESSIONID"].ToString());

            if (SessionCache.ContainsKey(telehub.RegionID) && SessionCache[telehub.RegionID] == SessionID)
                TelehubConnector.AddTelehub(telehub, SessionID);

            return SuccessResult();
        }
Esempio n. 3
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;
        }
        public Telehub FindTelehub(UUID regionID)
        {
            Dictionary<string, object> sendData = new Dictionary<string,object>();

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

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                           m_ServerURI + "/grid",
                           reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            if (replyData.Count != 0)
                            {
                                Telehub t = new Telehub();
                                t.FromKVP(replyData);
                                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;
        }