aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-09-02 19:54:53 +0100
committerUbitUmarov2015-09-02 19:54:53 +0100
commita11edceb00b5b86f825bd957bdac9edb91f893dd (patch)
treec192eae26f3aadf365a66f32fc6d9ade2f0a0c61 /OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
parentbad merge? (diff)
downloadopensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.zip
opensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.gz
opensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.bz2
opensim-SC_OLD-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.xz
seems to compile ( tests comented out)
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs131
1 files changed, 52 insertions, 79 deletions
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index 487c087..098c4b9 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Framework.RegionLoader.Web
58 } 58 }
59 else 59 else
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); 63 bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
64 64
@@ -69,101 +69,74 @@ namespace OpenSim.Framework.RegionLoader.Web
69 } 69 }
70 else 70 else
71 { 71 {
72 while(tries > 0) 72 while (tries > 0)
73 { 73 {
74 RegionInfo[] regionInfos = new RegionInfo[] {}; 74 RegionInfo[] regionInfos = new RegionInfo[] { };
75 int regionCount = 0; 75 int regionCount = 0;
76 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); 76 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
77 webRequest.Timeout = 30000; //30 Second Timeout 77 webRequest.Timeout = 30000; //30 Second Timeout
78 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); 78 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
79
80 try
81 {
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 == "Nini")
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 79
124<<<<<<< HEAD 80 try
125 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
126 xmlSource.Length);
127 XmlDocument xmlDoc = new XmlDocument();
128 xmlDoc.LoadXml(xmlSource);
129 if (xmlDoc.FirstChild.Name == "Nini")
130 { 81 {
131 regionCount = xmlDoc.FirstChild.ChildNodes.Count; 82 HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
132 83 m_log.Debug("[WEBLOADER]: Downloading region information...");
133 if (regionCount > 0) 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 == "Nini")
134 { 97 {
135 regionInfos = new RegionInfo[regionCount]; 98 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
136 int i; 99
137 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) 100 if (regionCount > 0)
138 { 101 {
139 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); 102 regionInfos = new RegionInfo[regionCount];
140 regionInfos[i] = 103 int i;
141 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); 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 }
142 } 110 }
143 } 111 }
144 } 112 }
145 } 113 catch (WebException ex)
146 catch (WebException ex) 114 {
147 { 115 if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
148 using (HttpWebResponse response = (HttpWebResponse)ex.Response) 116 {
149======= 117 if (!allowRegionless)
150 if (regionCount > 0 | allowRegionless) 118 throw ex;
151 return regionInfos; 119 }
120 else
121 throw ex;
122 }
123
124 if (regionCount > 0 | allowRegionless)
125 return regionInfos;
152 126
153 m_log.Debug("[WEBLOADER]: Request yielded no regions."); 127 m_log.Debug("[WEBLOADER]: Request yielded no regions.");
154 tries--; 128 tries--;
155 if (tries > 0) 129 if (tries > 0)
156>>>>>>> avn/ubitvar
157 { 130 {
158 m_log.Debug("[WEBLOADER]: Retrying"); 131 m_log.Debug("[WEBLOADER]: Retrying");
159 System.Threading.Thread.Sleep(wait); 132 System.Threading.Thread.Sleep(wait);
160 } 133 }
161 } 134 }
162 135
163 m_log.Error("[WEBLOADER]: No region configs were available."); 136 m_log.Error("[WEBLOADER]: No region configs were available.");
164 return null; 137 return null;
165 } 138 }
166 } 139 }
167 } 140 }
168 } 141 }
169} 142} \ No newline at end of file