aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs81
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs115
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs8
-rw-r--r--OpenSim/Services/MapImageService/MapImageService.cs6
4 files changed, 112 insertions, 98 deletions
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs
index ff0e9d9..520d639 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs
@@ -36,6 +36,7 @@ using Nini.Config;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Server.Base;
39using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
40using OpenMetaverse; 41using OpenMetaverse;
41using OpenMetaverse.StructuredData; 42using OpenMetaverse.StructuredData;
@@ -83,60 +84,57 @@ namespace OpenSim.Services.Connectors
83 throw new Exception("MapImage connector init error"); 84 throw new Exception("MapImage connector init error");
84 } 85 }
85 m_ServerURI = serviceURI; 86 m_ServerURI = serviceURI;
87 m_ServerURI = serviceURI.TrimEnd('/');
86 } 88 }
87 89
88 public bool AddMapTile(int x, int y, byte[] pngData, out string reason) 90 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason)
89 { 91 {
90 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() 92 reason = string.Empty;
91 {
92 new MultipartForm.Parameter("X", x.ToString()),
93 new MultipartForm.Parameter("Y", y.ToString()),
94 new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
95 };
96
97 reason = string.Empty;
98 int tickstart = Util.EnvironmentTickCount(); 93 int tickstart = Util.EnvironmentTickCount();
94 Dictionary<string, object> sendData = new Dictionary<string, object>();
95 sendData["X"] = x.ToString();
96 sendData["Y"] = y.ToString();
97 sendData["TYPE"] = "image/jpeg";
98 sendData["DATA"] = Convert.ToBase64String(jpgData);
99
100 string reqString = ServerUtils.BuildQueryString(sendData);
99 101
100 // Make the remote storage request
101 try 102 try
102 { 103 {
103 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); 104 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
104 request.Timeout = 20000; 105 m_ServerURI + "/map",
105 request.ReadWriteTimeout = 5000; 106 reqString);
106 107 if (reply != string.Empty)
107 using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
108 { 108 {
109 using (Stream responseStream = response.GetResponseStream()) 109 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
110
111 if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
110 { 112 {
111 string responseStr = responseStream.GetStreamString(); 113 return true;
112 OSD responseOSD = OSDParser.Deserialize(responseStr);
113 if (responseOSD.Type == OSDType.Map)
114 {
115 OSDMap responseMap = (OSDMap)responseOSD;
116 if (responseMap["Success"].AsBoolean())
117 return true;
118
119 reason = "Upload failed: " + responseMap["Message"].AsString();
120 }
121 else
122 {
123 reason = "Response format was invalid:\n" + responseStr;
124 }
125 } 114 }
115 else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
116 {
117 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
118 reason = replyData["Message"].ToString();
119 return false;
120 }
121 else if (!replyData.ContainsKey("Result"))
122 {
123 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
124 }
125 else
126 {
127 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
128 reason = "Unexpected result " + replyData["Result"].ToString();
129 }
130
126 } 131 }
132 else
133 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RegisterRegion received null reply");
127 } 134 }
128 catch (WebException we) 135 catch (Exception e)
129 {
130 reason = we.Message;
131 if (we.Status == WebExceptionStatus.ProtocolError)
132 {
133 HttpWebResponse webResponse = (HttpWebResponse)we.Response;
134 reason = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription);
135 }
136 }
137 catch (Exception ex)
138 { 136 {
139 reason = ex.Message; 137 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
140 } 138 }
141 finally 139 finally
142 { 140 {
@@ -146,6 +144,7 @@ namespace OpenSim.Services.Connectors
146 } 144 }
147 145
148 return false; 146 return false;
147
149 } 148 }
150 149
151 public byte[] GetMapTile(string fileName, out string format) 150 public byte[] GetMapTile(string fileName, out string format)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 5262598..83ec122 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService
63 protected GatekeeperServiceConnector m_GatekeeperConnector; 63 protected GatekeeperServiceConnector m_GatekeeperConnector;
64 64
65 protected UUID m_ScopeID = UUID.Zero; 65 protected UUID m_ScopeID = UUID.Zero;
66 protected bool m_Check4096 = true; 66// protected bool m_Check4096 = true;
67 protected string m_MapTileDirectory = string.Empty; 67 protected string m_MapTileDirectory = string.Empty;
68 protected string m_ThisGatekeeper = string.Empty; 68 protected string m_ThisGatekeeper = string.Empty;
69 protected Uri m_ThisGatekeeperURI = null; 69 protected Uri m_ThisGatekeeperURI = null;
@@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
121 if (scope != string.Empty) 121 if (scope != string.Empty)
122 UUID.TryParse(scope, out m_ScopeID); 122 UUID.TryParse(scope, out m_ScopeID);
123 123
124 m_Check4096 = gridConfig.GetBoolean("Check4096", true); 124// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
125 125
126 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); 126 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
127 127
@@ -347,14 +347,18 @@ namespace OpenSim.Services.GridService
347 return true; 347 return true;
348 } 348 }
349 349
350 uint x, y; 350 // We are now performing this check for each individual teleport in the EntityTransferModule instead. This
351 if (m_Check4096 && !Check4096(handle, out x, out y)) 351 // allows us to give better feedback when teleports fail because of the distance reason (which can't be
352 { 352 // done here) and it also hypergrid teleports that are within range (possibly because the source grid
353 RemoveHyperlinkRegion(regInfo.RegionID); 353 // itself has regions that are very far apart).
354 reason = "Region is too far (" + x + ", " + y + ")"; 354// uint x, y;
355 m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); 355// if (m_Check4096 && !Check4096(handle, out x, out y))
356 return false; 356// {
357 } 357// //RemoveHyperlinkRegion(regInfo.RegionID);
358// reason = "Region is too far (" + x + ", " + y + ")";
359// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
360// //return false;
361// }
358 362
359 regInfo.RegionID = regionID; 363 regInfo.RegionID = regionID;
360 364
@@ -405,60 +409,59 @@ namespace OpenSim.Services.GridService
405 } 409 }
406 } 410 }
407 411
408 /// <summary> 412// Not currently used
409 /// Cope with this viewer limitation. 413// /// <summary>
410 /// </summary> 414// /// Cope with this viewer limitation.
411 /// <param name="regInfo"></param> 415// /// </summary>
412 /// <returns></returns> 416// /// <param name="regInfo"></param>
413 public bool Check4096(ulong realHandle, out uint x, out uint y) 417// /// <returns></returns>
414 { 418// public bool Check4096(ulong realHandle, out uint x, out uint y)
415 uint ux = 0, uy = 0; 419// {
416 Utils.LongToUInts(realHandle, out ux, out uy); 420// uint ux = 0, uy = 0;
417 x = ux / Constants.RegionSize; 421// Utils.LongToUInts(realHandle, out ux, out uy);
418 y = uy / Constants.RegionSize; 422// x = ux / Constants.RegionSize;
419 423// y = uy / Constants.RegionSize;
420 const uint limit = (4096 - 1) * Constants.RegionSize; 424//
421 uint xmin = ux - limit; 425// const uint limit = (4096 - 1) * Constants.RegionSize;
422 uint xmax = ux + limit; 426// uint xmin = ux - limit;
423 uint ymin = uy - limit; 427// uint xmax = ux + limit;
424 uint ymax = uy + limit; 428// uint ymin = uy - limit;
425 // World map boundary checks 429// uint ymax = uy + limit;
426 if (xmin < 0 || xmin > ux) 430// // World map boundary checks
427 xmin = 0; 431// if (xmin < 0 || xmin > ux)
428 if (xmax > int.MaxValue || xmax < ux) 432// xmin = 0;
429 xmax = int.MaxValue; 433// if (xmax > int.MaxValue || xmax < ux)
430 if (ymin < 0 || ymin > uy) 434// xmax = int.MaxValue;
431 ymin = 0; 435// if (ymin < 0 || ymin > uy)
432 if (ymax > int.MaxValue || ymax < uy) 436// ymin = 0;
433 ymax = int.MaxValue; 437// if (ymax > int.MaxValue || ymax < uy)
434 438// ymax = int.MaxValue;
435 // Check for any regions that are within the possible teleport range to the linked region 439//
436 List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); 440// // Check for any regions that are within the possible teleport range to the linked region
437 if (regions.Count == 0) 441// List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
438 { 442// if (regions.Count == 0)
439 return false; 443// {
440 } 444// return false;
441 else 445// }
442 { 446// else
443 // Check for regions which are not linked regions 447// {
444 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); 448// // Check for regions which are not linked regions
445 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); 449// List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
446 if (availableRegions.Count() == 0) 450// IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
447 return false; 451// if (availableRegions.Count() == 0)
448 } 452// return false;
449 453// }
450 return true; 454//
451 } 455// return true;
456// }
452 457
453 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 458 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
454 { 459 {
455
456 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); 460 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
457 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; 461 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
458 rdata.Data["flags"] = flags.ToString(); 462 rdata.Data["flags"] = flags.ToString();
459 463
460 m_Database.Store(rdata); 464 m_Database.Store(rdata);
461
462 } 465 }
463 466
464 private void RemoveHyperlinkRegion(UUID regionID) 467 private void RemoveHyperlinkRegion(UUID regionID)
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 5d1779a..2b15896 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -112,6 +112,14 @@ namespace OpenSim.Services.LLLoginService
112 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); 112 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
113 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); 113 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);
114 114
115 // Clean up some of these vars
116 if (m_MapTileURL != String.Empty)
117 {
118 m_MapTileURL = m_MapTileURL.Trim();
119 if (!m_MapTileURL.EndsWith("/"))
120 m_MapTileURL = m_MapTileURL + "/";
121 }
122
115 // These are required; the others aren't 123 // These are required; the others aren't
116 if (accountService == string.Empty || authService == string.Empty) 124 if (accountService == string.Empty || authService == string.Empty)
117 throw new Exception("LoginService is missing service specifications"); 125 throw new Exception("LoginService is missing service specifications");
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs
index 736fa2e..7e7391c 100644
--- a/OpenSim/Services/MapImageService/MapImageService.cs
+++ b/OpenSim/Services/MapImageService/MapImageService.cs
@@ -23,6 +23,10 @@
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * The design of this map service is based on SimianGrid's PHP-based
28 * map service. See this URL for the original PHP version:
29 * https://github.com/openmetaversefoundation/simiangrid/
26 */ 30 */
27 31
28using System; 32using System;
@@ -139,7 +143,7 @@ namespace OpenSim.Services.MapImageService
139 if (File.Exists(fullName)) 143 if (File.Exists(fullName))
140 { 144 {
141 format = Path.GetExtension(fileName).ToLower(); 145 format = Path.GetExtension(fileName).ToLower();
142 m_log.DebugFormat("[MAP IMAGE SERVICE]: Found file {0}, extension {1}", fileName, format); 146 //m_log.DebugFormat("[MAP IMAGE SERVICE]: Found file {0}, extension {1}", fileName, format);
143 return File.ReadAllBytes(fullName); 147 return File.ReadAllBytes(fullName);
144 } 148 }
145 else if (File.Exists(m_WaterTileFile)) 149 else if (File.Exists(m_WaterTileFile))