diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Framework/RegionLoader | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Framework/RegionLoader')
-rw-r--r-- | OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 110 |
1 files changed, 66 insertions, 44 deletions
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index f60bb12..487c087 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!"); |
@@ -66,34 +69,59 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
66 | } | 69 | } |
67 | else | 70 | else |
68 | { | 71 | { |
69 | RegionInfo[] regionInfos = new RegionInfo[] {}; | 72 | while(tries > 0) |
70 | int regionCount = 0; | 73 | { |
71 | HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); | 74 | RegionInfo[] regionInfos = new RegionInfo[] {}; |
72 | webRequest.Timeout = 30000; //30 Second Timeout | 75 | int regionCount = 0; |
73 | m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); | 76 | HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); |
74 | 77 | webRequest.Timeout = 30000; //30 Second Timeout | |
75 | try | 78 | m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); |
76 | { | ||
77 | string xmlSource = String.Empty; | ||
78 | |||
79 | using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse()) | ||
80 | { | ||
81 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | ||
82 | 79 | ||
83 | using (Stream s = webResponse.GetResponseStream()) | 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") | ||
84 | { | 97 | { |
85 | using (StreamReader reader = new StreamReader(s)) | 98 | regionCount = xmlDoc.FirstChild.ChildNodes.Count; |
86 | { | 99 | |
87 | string tempStr = reader.ReadLine(); | 100 | if (regionCount > 0) |
88 | while (tempStr != null) | 101 | { |
89 | { | 102 | regionInfos = new RegionInfo[regionCount]; |
90 | xmlSource = xmlSource + tempStr; | 103 | int i; |
91 | tempStr = reader.ReadLine(); | 104 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) |
92 | } | 105 | { |
93 | } | 106 | m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); |
94 | } | 107 | regionInfos[i] = |
95 | } | 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 | } | ||
96 | 123 | ||
124 | <<<<<<< HEAD | ||
97 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | 125 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + |
98 | xmlSource.Length); | 126 | xmlSource.Length); |
99 | XmlDocument xmlDoc = new XmlDocument(); | 127 | XmlDocument xmlDoc = new XmlDocument(); |
@@ -118,28 +146,22 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
118 | catch (WebException ex) | 146 | catch (WebException ex) |
119 | { | 147 | { |
120 | using (HttpWebResponse response = (HttpWebResponse)ex.Response) | 148 | using (HttpWebResponse response = (HttpWebResponse)ex.Response) |
149 | ======= | ||
150 | if (regionCount > 0 | allowRegionless) | ||
151 | return regionInfos; | ||
152 | |||
153 | m_log.Debug("[WEBLOADER]: Request yielded no regions."); | ||
154 | tries--; | ||
155 | if (tries > 0) | ||
156 | >>>>>>> avn/ubitvar | ||
121 | { | 157 | { |
122 | if (response.StatusCode == HttpStatusCode.NotFound) | 158 | m_log.Debug("[WEBLOADER]: Retrying"); |
123 | { | 159 | System.Threading.Thread.Sleep(wait); |
124 | if (!allowRegionless) | ||
125 | throw ex; | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | throw ex; | ||
130 | } | ||
131 | } | 160 | } |
132 | } | 161 | } |
133 | 162 | ||
134 | if (regionCount > 0 | allowRegionless) | 163 | m_log.Error("[WEBLOADER]: No region configs were available."); |
135 | { | 164 | return null; |
136 | return regionInfos; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | m_log.Error("[WEBLOADER]: No region configs were available."); | ||
141 | return null; | ||
142 | } | ||
143 | } | 165 | } |
144 | } | 166 | } |
145 | } | 167 | } |