diff options
Diffstat (limited to 'OpenSim/Services/Connectors')
7 files changed, 87 insertions, 85 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5c50936..5004d99 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs | |||
@@ -73,7 +73,6 @@ namespace OpenSim.Services.Connectors | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | |||
77 | public virtual string Helo() | 76 | public virtual string Helo() |
78 | { | 77 | { |
79 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | 78 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); |
@@ -82,10 +81,12 @@ namespace OpenSim.Services.Connectors | |||
82 | 81 | ||
83 | try | 82 | try |
84 | { | 83 | { |
85 | WebResponse response = req.GetResponse(); | 84 | using (WebResponse response = req.GetResponse()) |
86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null | 85 | { |
87 | return string.Empty; | 86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null |
88 | return response.Headers.Get("X-Handlers-Provided"); | 87 | return string.Empty; |
88 | return response.Headers.Get("X-Handlers-Provided"); | ||
89 | } | ||
89 | } | 90 | } |
90 | catch (Exception e) | 91 | catch (Exception e) |
91 | { | 92 | { |
@@ -95,6 +96,5 @@ namespace OpenSim.Services.Connectors | |||
95 | // fail | 96 | // fail |
96 | return string.Empty; | 97 | return string.Empty; |
97 | } | 98 | } |
98 | |||
99 | } | 99 | } |
100 | } | 100 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index c542c29..d7e38f1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -169,41 +169,45 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
169 | // Let's wait for the response | 169 | // Let's wait for the response |
170 | //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); | 170 | //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); |
171 | 171 | ||
172 | WebResponse webResponse = null; | ||
173 | StreamReader sr = null; | ||
174 | try | 172 | try |
175 | { | 173 | { |
176 | webResponse = AgentCreateRequest.GetResponse(); | 174 | using (WebResponse webResponse = AgentCreateRequest.GetResponse()) |
177 | if (webResponse == null) | ||
178 | { | 175 | { |
179 | m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); | 176 | if (webResponse == null) |
180 | } | ||
181 | else | ||
182 | { | ||
183 | |||
184 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
185 | string response = sr.ReadToEnd().Trim(); | ||
186 | m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); | ||
187 | |||
188 | if (!String.IsNullOrEmpty(response)) | ||
189 | { | 177 | { |
190 | try | 178 | m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); |
191 | { | 179 | } |
192 | // we assume we got an OSDMap back | 180 | else |
193 | OSDMap r = Util.GetOSDMap(response); | 181 | { |
194 | bool success = r["success"].AsBoolean(); | 182 | using (Stream s = webResponse.GetResponseStream()) |
195 | reason = r["reason"].AsString(); | ||
196 | return success; | ||
197 | } | ||
198 | catch (NullReferenceException e) | ||
199 | { | 183 | { |
200 | m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); | 184 | using (StreamReader sr = new StreamReader(s)) |
201 | 185 | { | |
202 | // check for old style response | 186 | string response = sr.ReadToEnd().Trim(); |
203 | if (response.ToLower().StartsWith("true")) | 187 | m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); |
204 | return true; | 188 | |
205 | 189 | if (!String.IsNullOrEmpty(response)) | |
206 | return false; | 190 | { |
191 | try | ||
192 | { | ||
193 | // we assume we got an OSDMap back | ||
194 | OSDMap r = Util.GetOSDMap(response); | ||
195 | bool success = r["success"].AsBoolean(); | ||
196 | reason = r["reason"].AsString(); | ||
197 | return success; | ||
198 | } | ||
199 | catch (NullReferenceException e) | ||
200 | { | ||
201 | m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); | ||
202 | |||
203 | // check for old style response | ||
204 | if (response.ToLower().StartsWith("true")) | ||
205 | return true; | ||
206 | |||
207 | return false; | ||
208 | } | ||
209 | } | ||
210 | } | ||
207 | } | 211 | } |
208 | } | 212 | } |
209 | } | 213 | } |
@@ -214,11 +218,6 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
214 | reason = "Destination did not reply"; | 218 | reason = "Destination did not reply"; |
215 | return false; | 219 | return false; |
216 | } | 220 | } |
217 | finally | ||
218 | { | ||
219 | if (sr != null) | ||
220 | sr.Close(); | ||
221 | } | ||
222 | 221 | ||
223 | return true; | 222 | return true; |
224 | 223 | ||
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 7688e0f..b36fa23 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -168,22 +168,27 @@ namespace OpenSim.Services.Connectors | |||
168 | // Let's wait for the response | 168 | // Let's wait for the response |
169 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | 169 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); |
170 | 170 | ||
171 | StreamReader sr = null; | ||
172 | try | 171 | try |
173 | { | 172 | { |
174 | WebResponse webResponse = helloNeighbourRequest.GetResponse(); | 173 | using (WebResponse webResponse = helloNeighbourRequest.GetResponse()) |
175 | if (webResponse == null) | ||
176 | { | 174 | { |
177 | m_log.DebugFormat( | 175 | if (webResponse == null) |
178 | "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", | 176 | { |
179 | thisRegion.RegionName, region.RegionName); | 177 | m_log.DebugFormat( |
178 | "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", | ||
179 | thisRegion.RegionName, region.RegionName); | ||
180 | } | ||
181 | |||
182 | using (Stream s = webResponse.GetResponseStream()) | ||
183 | { | ||
184 | using (StreamReader sr = new StreamReader(s)) | ||
185 | { | ||
186 | //reply = sr.ReadToEnd().Trim(); | ||
187 | sr.ReadToEnd().Trim(); | ||
188 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
189 | } | ||
190 | } | ||
180 | } | 191 | } |
181 | |||
182 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
183 | //reply = sr.ReadToEnd().Trim(); | ||
184 | sr.ReadToEnd().Trim(); | ||
185 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
186 | |||
187 | } | 192 | } |
188 | catch (Exception e) | 193 | catch (Exception e) |
189 | { | 194 | { |
@@ -193,11 +198,6 @@ namespace OpenSim.Services.Connectors | |||
193 | 198 | ||
194 | return false; | 199 | return false; |
195 | } | 200 | } |
196 | finally | ||
197 | { | ||
198 | if (sr != null) | ||
199 | sr.Close(); | ||
200 | } | ||
201 | 201 | ||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs index bfb681b..8b18afb 100644 --- a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.5.*")] | 32 | [assembly: AssemblyVersion("0.7.6.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 63a32e7..74b980c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -339,36 +339,38 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
339 | // Simian does not require the asset ID to be in the URL because it's in the post data. | 339 | // Simian does not require the asset ID to be in the URL because it's in the post data. |
340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs | 340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs |
341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); | 341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); |
342 | |||
343 | HttpWebResponse response = MultipartForm.Post(request, postParameters); | ||
344 | using (Stream responseStream = response.GetResponseStream()) | ||
345 | { | ||
346 | string responseStr = null; | ||
347 | 342 | ||
348 | try | 343 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) |
344 | { | ||
345 | using (Stream responseStream = response.GetResponseStream()) | ||
349 | { | 346 | { |
350 | responseStr = responseStream.GetStreamString(); | 347 | string responseStr = null; |
351 | OSD responseOSD = OSDParser.Deserialize(responseStr); | 348 | |
352 | if (responseOSD.Type == OSDType.Map) | 349 | try |
353 | { | 350 | { |
354 | OSDMap responseMap = (OSDMap)responseOSD; | 351 | responseStr = responseStream.GetStreamString(); |
355 | if (responseMap["Success"].AsBoolean()) | 352 | OSD responseOSD = OSDParser.Deserialize(responseStr); |
356 | return asset.ID; | 353 | if (responseOSD.Type == OSDType.Map) |
354 | { | ||
355 | OSDMap responseMap = (OSDMap)responseOSD; | ||
356 | if (responseMap["Success"].AsBoolean()) | ||
357 | return asset.ID; | ||
358 | else | ||
359 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
360 | } | ||
357 | else | 361 | else |
358 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | 362 | { |
363 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
364 | } | ||
359 | } | 365 | } |
360 | else | 366 | catch (Exception ex) |
361 | { | 367 | { |
362 | errorMessage = "Response format was invalid:\n" + responseStr; | 368 | if (!String.IsNullOrEmpty(responseStr)) |
369 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
370 | else | ||
371 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
363 | } | 372 | } |
364 | } | 373 | } |
365 | catch (Exception ex) | ||
366 | { | ||
367 | if (!String.IsNullOrEmpty(responseStr)) | ||
368 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
369 | else | ||
370 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
371 | } | ||
372 | } | 374 | } |
373 | } | 375 | } |
374 | catch (WebException ex) | 376 | catch (WebException ex) |
@@ -378,6 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
378 | 380 | ||
379 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", | 381 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", |
380 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); | 382 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); |
383 | |||
381 | return null; | 384 | return null; |
382 | } | 385 | } |
383 | 386 | ||
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 508baf7..ef2494a 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -315,7 +315,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
315 | 315 | ||
316 | try | 316 | try |
317 | { | 317 | { |
318 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000, false); | 318 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false); |
319 | bool success = result["success"].AsBoolean(); | 319 | bool success = result["success"].AsBoolean(); |
320 | if (result.ContainsKey("_Result")) | 320 | if (result.ContainsKey("_Result")) |
321 | { | 321 | { |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 5731e2f..6b2d710 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors | |||
162 | 162 | ||
163 | if (replyData != null) | 163 | if (replyData != null) |
164 | { | 164 | { |
165 | if (replyData.ContainsKey("result") && replyData.ContainsKey("result").ToString() == "null") | 165 | if (replyData.ContainsKey("result") && replyData["result"].ToString() == "null") |
166 | { | 166 | { |
167 | return accounts; | 167 | return accounts; |
168 | } | 168 | } |