aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionLoader
diff options
context:
space:
mode:
authorMelanie Thielker2010-07-17 02:38:00 +0200
committerMelanie Thielker2010-07-17 02:38:00 +0200
commite06b7ee3689bdfd8d71ef3199edb2fb220ec5c21 (patch)
treeafdce8281b0457dce695d42e2bfa8bcfc7aed9b4 /OpenSim/Framework/RegionLoader
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC_OLD-e06b7ee3689bdfd8d71ef3199edb2fb220ec5c21.zip
opensim-SC_OLD-e06b7ee3689bdfd8d71ef3199edb2fb220ec5c21.tar.gz
opensim-SC_OLD-e06b7ee3689bdfd8d71ef3199edb2fb220ec5c21.tar.bz2
opensim-SC_OLD-e06b7ee3689bdfd8d71ef3199edb2fb220ec5c21.tar.xz
Make webloading more robust by addign retries
Diffstat (limited to 'OpenSim/Framework/RegionLoader')
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs48
1 files changed, 22 insertions, 26 deletions
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index 0ec4af5..dd224cd 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -48,6 +48,9 @@ namespace OpenSim.Framework.RegionLoader.Web
48 48
49 public RegionInfo[] LoadRegions() 49 public RegionInfo[] LoadRegions()
50 { 50 {
51 int tries = 3;
52 int wait = 2000;
53
51 if (m_configSource == null) 54 if (m_configSource == null)
52 { 55 {
53 m_log.Error("[WEBLOADER]: Unable to load configuration source!"); 56 m_log.Error("[WEBLOADER]: Unable to load configuration source!");
@@ -64,35 +67,28 @@ namespace OpenSim.Framework.RegionLoader.Web
64 } 67 }
65 else 68 else
66 { 69 {
67 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); 70 while (tries > 0)
68 webRequest.Timeout = 30000; //30 Second Timeout
69 m_log.Debug("[WEBLOADER]: Sending Download Request...");
70 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
71 m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
72 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
73 string xmlSource = String.Empty;
74 string tempStr = reader.ReadLine();
75 while (tempStr != null)
76 {
77 xmlSource = xmlSource + tempStr;
78 tempStr = reader.ReadLine();
79 }
80 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
81 xmlSource.Length);
82 XmlDocument xmlDoc = new XmlDocument();
83 xmlDoc.LoadXml(xmlSource);
84 if (xmlDoc.FirstChild.Name == "Regions")
85 { 71 {
86 RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count]; 72 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
87 int i; 73 webRequest.Timeout = 30000; //30 Second Timeout
88 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) 74 m_log.Debug("[WEBLOADER]: Sending Download Request...");
75 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
76 m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
77 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
78 string xmlSource = String.Empty;
79 string tempStr = reader.ReadLine();
80 while (tempStr != null)
89 { 81 {
90 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); 82 xmlSource = xmlSource + tempStr;
91 regionInfos[i] = 83 tempStr = reader.ReadLine();
92 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); 84 }
85 m_log.Debug("[WEBLOADER]: Request yielded no regions.");
86 tries--;
87 if (tries > 0)
88 {
89 m_log.Debug("[WEBLOADER]: Retrying");
90 System.Threading.Thread.Sleep(wait);
93 } 91 }
94
95 return regionInfos;
96 } 92 }
97 return null; 93 return null;
98 } 94 }