diff options
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid')
3 files changed, 101 insertions, 1 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 3bd11d9..c402907 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs | |||
@@ -102,6 +102,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
102 | m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); | 102 | m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); |
103 | } | 103 | } |
104 | 104 | ||
105 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
106 | { | ||
107 | realID = UUID.Zero; | ||
108 | return Authenticate(principalID, password, lifetime); | ||
109 | } | ||
110 | |||
105 | public string Authenticate(UUID principalID, string password, int lifetime) | 111 | public string Authenticate(UUID principalID, string password, int lifetime) |
106 | { | 112 | { |
107 | NameValueCollection requestArgs = new NameValueCollection | 113 | NameValueCollection requestArgs = new NameValueCollection |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index b031f21..6043b70 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
31 | using System.IO; | 33 | using System.IO; |
32 | using System.Net; | 34 | using System.Net; |
33 | using System.Reflection; | 35 | using System.Reflection; |
@@ -100,6 +102,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
100 | 102 | ||
101 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) | 103 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) |
102 | { | 104 | { |
105 | IPEndPoint ext = regionInfo.ExternalEndPoint; | ||
106 | if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint"; | ||
107 | // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service | ||
108 | // Scene scene; | ||
109 | // if (m_scenes.TryGetValue(regionInfo.RegionID, out scene)) | ||
110 | // UploadMapTile(scene); | ||
111 | // else | ||
112 | // m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); | ||
113 | |||
103 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 114 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
104 | Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight); | 115 | Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight); |
105 | 116 | ||
@@ -108,7 +119,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
108 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, | 119 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, |
109 | { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, | 120 | { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, |
110 | { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, | 121 | { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, |
111 | { "ExternalAddress", OSD.FromString(regionInfo.ExternalEndPoint.Address.ToString()) }, | 122 | { "ExternalAddress", OSD.FromString(ext.Address.ToString()) }, |
112 | { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, | 123 | { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, |
113 | { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, | 124 | { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, |
114 | { "Access", OSD.FromInteger(regionInfo.Access) }, | 125 | { "Access", OSD.FromInteger(regionInfo.Access) }, |
@@ -412,6 +423,83 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
412 | 423 | ||
413 | #endregion IGridService | 424 | #endregion IGridService |
414 | 425 | ||
426 | private void UploadMapTile(IScene scene) | ||
427 | { | ||
428 | string errorMessage = null; | ||
429 | |||
430 | // Create a PNG map tile and upload it to the AddMapTile API | ||
431 | byte[] pngData = Utils.EmptyBytes; | ||
432 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | ||
433 | if (tileGenerator == null) | ||
434 | { | ||
435 | m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator"); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | using (Image mapTile = tileGenerator.CreateMapTile()) | ||
440 | { | ||
441 | using (MemoryStream stream = new MemoryStream()) | ||
442 | { | ||
443 | mapTile.Save(stream, ImageFormat.Png); | ||
444 | pngData = stream.ToArray(); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
449 | { | ||
450 | new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
451 | new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
452 | new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
453 | }; | ||
454 | |||
455 | // Make the remote storage request | ||
456 | try | ||
457 | { | ||
458 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | ||
459 | |||
460 | HttpWebResponse response = MultipartForm.Post(request, postParameters); | ||
461 | using (Stream responseStream = response.GetResponseStream()) | ||
462 | { | ||
463 | string responseStr = null; | ||
464 | |||
465 | try | ||
466 | { | ||
467 | responseStr = responseStream.GetStreamString(); | ||
468 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
469 | if (responseOSD.Type == OSDType.Map) | ||
470 | { | ||
471 | OSDMap responseMap = (OSDMap)responseOSD; | ||
472 | if (responseMap["Success"].AsBoolean()) | ||
473 | m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile"); | ||
474 | else | ||
475 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
476 | } | ||
477 | else | ||
478 | { | ||
479 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
480 | } | ||
481 | } | ||
482 | catch (Exception ex) | ||
483 | { | ||
484 | if (!String.IsNullOrEmpty(responseStr)) | ||
485 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
486 | else | ||
487 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
488 | } | ||
489 | } | ||
490 | } | ||
491 | catch (WebException ex) | ||
492 | { | ||
493 | errorMessage = ex.Message; | ||
494 | } | ||
495 | |||
496 | if (!String.IsNullOrEmpty(errorMessage)) | ||
497 | { | ||
498 | m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}", | ||
499 | pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' ')); | ||
500 | } | ||
501 | } | ||
502 | |||
415 | private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) | 503 | private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) |
416 | { | 504 | { |
417 | NameValueCollection requestArgs = new NameValueCollection | 505 | NameValueCollection requestArgs = new NameValueCollection |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 698c4c0..08c5c50 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -191,9 +191,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | <<<<<<< HEAD | ||
194 | public void InvalidateCache(UUID userID) | 195 | public void InvalidateCache(UUID userID) |
195 | { | 196 | { |
196 | m_accountCache.Remove(userID); | 197 | m_accountCache.Remove(userID); |
198 | ======= | ||
199 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
200 | { | ||
201 | return null; | ||
202 | >>>>>>> avn/ubitvar | ||
197 | } | 203 | } |
198 | 204 | ||
199 | public bool StoreUserAccount(UserAccount data) | 205 | public bool StoreUserAccount(UserAccount data) |