aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionLoader/Web
diff options
context:
space:
mode:
authorMelanie2011-10-11 23:01:52 +0100
committerMelanie2011-10-11 23:01:52 +0100
commit5536cdf90ce17987ad5447187ebdd00af231ea75 (patch)
treea0ad547ffb9d4517ee62258d682504124b861dda /OpenSim/Framework/RegionLoader/Web
parentMerge commit 'c14c4bc1ec5f381aa754068caf460c95e4539b17' into bigmerge (diff)
parentAdded a setting to [Startup] section of config that will allow the simulator ... (diff)
downloadopensim-SC_OLD-5536cdf90ce17987ad5447187ebdd00af231ea75.zip
opensim-SC_OLD-5536cdf90ce17987ad5447187ebdd00af231ea75.tar.gz
opensim-SC_OLD-5536cdf90ce17987ad5447187ebdd00af231ea75.tar.bz2
opensim-SC_OLD-5536cdf90ce17987ad5447187ebdd00af231ea75.tar.xz
Merge commit '39d7945efc8daa6e5cd0f4728b499e7a624526cd' into bigmerge
Conflicts: OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
Diffstat (limited to 'OpenSim/Framework/RegionLoader/Web')
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs93
1 files changed, 59 insertions, 34 deletions
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index f0ffc2c..c7caf6f 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Framework.RegionLoader.Web
60 { 60 {
61 IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"]; 61 IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
62 string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim(); 62 string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
63 bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
64
63 if (url == String.Empty) 65 if (url == String.Empty)
64 { 66 {
65 m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty."); 67 m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
@@ -67,39 +69,60 @@ namespace OpenSim.Framework.RegionLoader.Web
67 } 69 }
68 else 70 else
69 { 71 {
70 while (tries > 0) 72 while(tries > 0)
71 { 73 {
72 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); 74 RegionInfo[] regionInfos = new RegionInfo[] {};
73 webRequest.Timeout = 30000; //30 Second Timeout 75 int regionCount = 0;
74 m_log.Debug("[WEBLOADER]: Sending Download Request..."); 76 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
75 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); 77 webRequest.Timeout = 30000; //30 Second Timeout
76 m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); 78 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
77 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
78 string xmlSource = String.Empty;
79 string tempStr = reader.ReadLine();
80 while (tempStr != null)
81 {
82 xmlSource = xmlSource + tempStr;
83 tempStr = reader.ReadLine();
84 }
85 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
86 xmlSource.Length);
87 XmlDocument xmlDoc = new XmlDocument();
88 xmlDoc.LoadXml(xmlSource);
89 if (xmlDoc.FirstChild.Name == "Regions")
90 {
91 RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
92 int i;
93 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
94 {
95 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
96 regionInfos[i] =
97 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
98 }
99 79
100 if (i > 0) 80 try
101 return regionInfos; 81 {
102 } 82 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
83 m_log.Debug("[WEBLOADER]: Downloading region information...");
84 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
85 string xmlSource = String.Empty;
86 string tempStr = reader.ReadLine();
87 while (tempStr != null)
88 {
89 xmlSource = xmlSource + tempStr;
90 tempStr = reader.ReadLine();
91 }
92 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
93 xmlSource.Length);
94 XmlDocument xmlDoc = new XmlDocument();
95 xmlDoc.LoadXml(xmlSource);
96 if (xmlDoc.FirstChild.Name == "Regions")
97 {
98 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
99
100 if (regionCount > 0)
101 {
102 regionInfos = new RegionInfo[regionCount];
103 int i;
104 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
105 {
106 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
107 regionInfos[i] =
108 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
109 }
110 }
111 }
112 }
113 catch (WebException ex)
114 {
115 if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
116 {
117 if (!allowRegionless)
118 throw ex;
119 }
120 else
121 throw ex;
122 }
123
124 if (regionCount > 0 | allowRegionless)
125 return regionInfos;
103 126
104 m_log.Debug("[WEBLOADER]: Request yielded no regions."); 127 m_log.Debug("[WEBLOADER]: Request yielded no regions.");
105 tries--; 128 tries--;
@@ -108,8 +131,10 @@ namespace OpenSim.Framework.RegionLoader.Web
108 m_log.Debug("[WEBLOADER]: Retrying"); 131 m_log.Debug("[WEBLOADER]: Retrying");
109 System.Threading.Thread.Sleep(wait); 132 System.Threading.Thread.Sleep(wait);
110 } 133 }
111 } 134 }
112 return null; 135
136 m_log.Error("[WEBLOADER]: No region configs were available.");
137 return null;
113 } 138 }
114 } 139 }
115 } 140 }