Esempio n. 1
0
 public override RegionCommsListener RegisterRegion(RegionInfo regionInfo)
 {
     if (!regionInfo.RegionID.Equals(UUID.Zero))
     {
         m_regionsOnInstance.Add(regionInfo);
         return(m_localBackend.RegisterRegion(regionInfo));
     }
     else
     {
         return(base.RegisterRegion(regionInfo));
     }
 }
Esempio n. 2
0
        // see IGridServices
        public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
        {
            if (m_regionsOnInstance.Contains(regionInfo))
            {
                m_log.Debug("[OGS1 GRID SERVICES] Foobar! Caller is confused, region already registered " + regionInfo.RegionName);
                Exception e = new Exception(String.Format("Unable to register region"));

                throw e;
            }

            m_regionsOnInstance.Add(regionInfo);

            m_log.InfoFormat(
                "[OGS1 GRID SERVICES]: Attempting to register region {0} with grid at {1}",
                regionInfo.RegionName, serversInfo.GridURL);

            Hashtable GridParams = new Hashtable();

            // Login / Authentication

            GridParams["authkey"]                 = serversInfo.GridSendKey;
            GridParams["recvkey"]                 = serversInfo.GridRecvKey;
            GridParams["UUID"]                    = regionInfo.RegionID.ToString();
            GridParams["sim_ip"]                  = regionInfo.ExternalHostName;
            GridParams["sim_port"]                = regionInfo.InternalEndPoint.Port.ToString();
            GridParams["region_locx"]             = regionInfo.RegionLocX.ToString();
            GridParams["region_locy"]             = regionInfo.RegionLocY.ToString();
            GridParams["sim_name"]                = regionInfo.RegionName;
            GridParams["http_port"]               = serversInfo.HttpListenerPort.ToString();
            GridParams["remoting_port"]           = ConfigSettings.DefaultRegionRemotingPort.ToString();
            GridParams["map-image-id"]            = regionInfo.RegionSettings.TerrainImageID.ToString();
            GridParams["originUUID"]              = regionInfo.originRegionID.ToString();
            GridParams["server_uri"]              = regionInfo.ServerURI;
            GridParams["region_secret"]           = regionInfo.regionSecret;
            GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString();

            if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero)
            {
                GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString();
            }
            else
            {
                GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString();
            }

            GridParams["maturity"] = regionInfo.RegionSettings.Maturity.ToString();

            // Package into an XMLRPC Request
            ArrayList SendParams = new ArrayList();

            SendParams.Add(GridParams);

            // Send Request
            XmlRpcRequest  GridReq = new XmlRpcRequest("simulator_login", SendParams);
            XmlRpcResponse GridResp;

            try
            {
                // The timeout should always be significantly larger than the timeout for the grid server to request
                // the initial status of the region before confirming registration.
                GridResp = GridReq.Send(serversInfo.GridURL, 90000);
            }
            catch (Exception e)
            {
                Exception e2
                    = new Exception(
                          String.Format(
                              "Unable to register region with grid at {0}. Grid service not running?",
                              serversInfo.GridURL),
                          e);

                throw e2;
            }

            Hashtable GridRespData = (Hashtable)GridResp.Value;

            // Hashtable griddatahash = GridRespData;

            // Process Response
            if (GridRespData.ContainsKey("error"))
            {
                string errorstring = (string)GridRespData["error"];

                Exception e = new Exception(
                    String.Format("Unable to connect to grid at {0}: {1}", serversInfo.GridURL, errorstring));

                throw e;
            }
            else
            {
                // m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
                if (GridRespData.ContainsKey("allow_forceful_banlines"))
                {
                    if ((string)GridRespData["allow_forceful_banlines"] != "TRUE")
                    {
                        //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle);
                        if (!m_queuedGridSettings.ContainsKey("allow_forceful_banlines"))
                        {
                            m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
                        }
                    }
                }

                m_log.InfoFormat(
                    "[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}",
                    regionInfo.RegionName, serversInfo.GridURL);
            }

            return(m_localBackend.RegisterRegion(regionInfo));
        }