aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs5
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs120
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs6
-rw-r--r--OpenSim/Services/InventoryService/HGInventoryService.cs4
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs9
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs21
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs4
8 files changed, 144 insertions, 27 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 470a4dd..3122382 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -144,7 +144,10 @@ namespace OpenSim.Services.AssetService
144 public string Store(AssetBase asset) 144 public string Store(AssetBase asset)
145 { 145 {
146 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); 146 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
147 m_Database.StoreAsset(asset); 147 if (!m_Database.StoreAsset(asset))
148 {
149 return UUID.Zero.ToString();
150 }
148 151
149 return asset.ID; 152 return asset.ID;
150 } 153 }
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index 65b3537..ad18a23 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -30,6 +30,7 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Timers;
33using Nini.Config; 34using Nini.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -48,7 +49,9 @@ namespace OpenSim.Services.Connectors
48 49
49 private string m_ServerURI = String.Empty; 50 private string m_ServerURI = String.Empty;
50 private IImprovedAssetCache m_Cache = null; 51 private IImprovedAssetCache m_Cache = null;
51 52 private int m_retryCounter;
53 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
54 private Timer m_retryTimer;
52 public AssetServicesConnector() 55 public AssetServicesConnector()
53 { 56 {
54 } 57 }
@@ -85,6 +88,55 @@ namespace OpenSim.Services.Connectors
85 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", 88 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset",
86 "dump asset <id> <file>", 89 "dump asset <id> <file>",
87 "dump one cached asset", HandleDumpAsset); 90 "dump one cached asset", HandleDumpAsset);
91
92 m_retryTimer = new Timer();
93 m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
94 m_retryTimer.Interval = 60000;
95 }
96
97 protected void retryCheck(object source, ElapsedEventArgs e)
98 {
99 m_retryCounter++;
100 if (m_retryCounter > 60) m_retryCounter -= 60;
101 List<int> keys = new List<int>();
102 foreach (int a in m_retryQueue.Keys)
103 {
104 keys.Add(a);
105 }
106 foreach (int a in keys)
107 {
108 //We exponentially fall back on frequency until we reach one attempt per hour
109 //The net result is that we end up in the queue for roughly 24 hours..
110 //24 hours worth of assets could be a lot, so the hope is that the region admin
111 //will have gotten the asset connector back online quickly!
112
113 int timefactor = a ^ 2;
114 if (timefactor > 60)
115 {
116 timefactor = 60;
117 }
118
119 //First, find out if we care about this timefactor
120 if (timefactor % a == 0)
121 {
122 //Yes, we do!
123 List<AssetBase> retrylist = m_retryQueue[a];
124 m_retryQueue.Remove(a);
125
126 foreach(AssetBase ass in retrylist)
127 {
128 Store(ass); //Store my ass. This function will put it back in the dictionary if it fails
129 }
130 }
131 }
132
133 if (m_retryQueue.Count == 0)
134 {
135 //It might only be one tick per minute, but I have
136 //repented and abandoned my wasteful ways
137 m_retryCounter = 0;
138 m_retryTimer.Stop();
139 }
88 } 140 }
89 141
90 protected void SetCache(IImprovedAssetCache cache) 142 protected void SetCache(IImprovedAssetCache cache)
@@ -99,8 +151,8 @@ namespace OpenSim.Services.Connectors
99 AssetBase asset = null; 151 AssetBase asset = null;
100 if (m_Cache != null) 152 if (m_Cache != null)
101 asset = m_Cache.Get(id); 153 asset = m_Cache.Get(id);
102 154
103 if (asset == null) 155 if (asset == null || asset.Data == null || asset.Data.Length == 0)
104 { 156 {
105 asset = SynchronousRestObjectRequester. 157 asset = SynchronousRestObjectRequester.
106 MakeRequest<int, AssetBase>("GET", uri, 0); 158 MakeRequest<int, AssetBase>("GET", uri, 0);
@@ -177,7 +229,7 @@ namespace OpenSim.Services.Connectors
177 if (m_Cache != null) 229 if (m_Cache != null)
178 asset = m_Cache.Get(id); 230 asset = m_Cache.Get(id);
179 231
180 if (asset == null) 232 if (asset == null || asset.Data == null || asset.Data.Length == 0)
181 { 233 {
182 bool result = false; 234 bool result = false;
183 235
@@ -204,11 +256,10 @@ namespace OpenSim.Services.Connectors
204 256
205 public string Store(AssetBase asset) 257 public string Store(AssetBase asset)
206 { 258 {
259 if (m_Cache != null)
260 m_Cache.Cache(asset);
207 if (asset.Temporary || asset.Local) 261 if (asset.Temporary || asset.Local)
208 { 262 {
209 if (m_Cache != null)
210 m_Cache.Cache(asset);
211
212 return asset.ID; 263 return asset.ID;
213 } 264 }
214 265
@@ -218,24 +269,57 @@ namespace OpenSim.Services.Connectors
218 try 269 try
219 { 270 {
220 newID = SynchronousRestObjectRequester. 271 newID = SynchronousRestObjectRequester.
221 MakeRequest<AssetBase, string>("POST", uri, asset); 272 MakeRequest<AssetBase, string>("POST", uri, asset, 25);
273 if (newID == null || newID == "")
274 {
275 newID = UUID.Zero.ToString();
276 }
222 } 277 }
223 catch (Exception e) 278 catch (Exception e)
224 { 279 {
225 m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); 280 newID = UUID.Zero.ToString();
226 } 281 }
227 282
228 if (newID != String.Empty) 283 if (newID == UUID.Zero.ToString())
229 { 284 {
230 // Placing this here, so that this work with old asset servers that don't send any reply back 285 //The asset upload failed, put it in a queue for later
231 // SynchronousRestObjectRequester returns somethins that is not an empty string 286 asset.UploadAttempts++;
232 if (newID != null) 287 if (asset.UploadAttempts > 30)
233 asset.ID = newID; 288 {
234 289 //By this stage we've been in the queue for a good few hours;
235 if (m_Cache != null) 290 //We're going to drop the asset.
236 m_Cache.Cache(asset); 291 m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString());
292 }
293 else
294 {
295 if (!m_retryQueue.ContainsKey(asset.UploadAttempts))
296 {
297 m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>());
298 }
299 List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts];
300 m_queue.Add(asset);
301 m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString());
302 m_retryTimer.Start();
303 }
304 }
305 else
306 {
307 if (asset.UploadAttempts > 0)
308 {
309 m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString());
310 }
311 if (newID != String.Empty)
312 {
313 // Placing this here, so that this work with old asset servers that don't send any reply back
314 // SynchronousRestObjectRequester returns somethins that is not an empty string
315 if (newID != null)
316 asset.ID = newID;
317
318 if (m_Cache != null)
319 m_Cache.Cache(asset);
320 }
237 } 321 }
238 return newID; 322 return asset.ID;
239 } 323 }
240 324
241 public bool UpdateContent(string id, byte[] data) 325 public bool UpdateContent(string id, byte[] data)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 34bb8b3..7a420e4 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
371 /// <returns></returns> 371 /// <returns></returns>
372 public bool Delete(string id) 372 public bool Delete(string id)
373 { 373 {
374 string errorMessage = String.Empty; 374 //string errorMessage = String.Empty;
375 string url = m_serverUrl + id; 375 string url = m_serverUrl + id;
376 376
377 if (m_cache != null) 377 if (m_cache != null)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index af603b2..ae80a8c 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -255,7 +255,11 @@ namespace OpenSim.Services.GridService
255 { 255 {
256 m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); 256 m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName);
257 } 257 }
258 regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; 258 string name = regInfo.RegionName;
259 regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort;
260 if (name != string.Empty)
261 regInfo.RegionName += ":" + name;
262
259 // Try get the map image 263 // Try get the map image
260 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 264 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
261 // I need a texture that works for this... the one I tried doesn't seem to be working 265 // I need a texture that works for this... the one I tried doesn't seem to be working
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs
index 061effe..6e6b019 100644
--- a/OpenSim/Services/InventoryService/HGInventoryService.cs
+++ b/OpenSim/Services/InventoryService/HGInventoryService.cs
@@ -108,13 +108,13 @@ namespace OpenSim.Services.InventoryService
108 // Warp! Root folder for travelers 108 // Warp! Root folder for travelers
109 XInventoryFolder[] folders = m_Database.GetFolders( 109 XInventoryFolder[] folders = m_Database.GetFolders(
110 new string[] { "agentID", "folderName"}, 110 new string[] { "agentID", "folderName"},
111 new string[] { principalID.ToString(), "Suitcase" }); 111 new string[] { principalID.ToString(), "My Suitcase" });
112 112
113 if (folders.Length > 0) 113 if (folders.Length > 0)
114 return ConvertToOpenSim(folders[0]); 114 return ConvertToOpenSim(folders[0]);
115 115
116 // make one 116 // make one
117 XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "Suitcase"); 117 XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Suitcase");
118 return ConvertToOpenSim(suitcase); 118 return ConvertToOpenSim(suitcase);
119 } 119 }
120 120
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index af831fd..f48bf60 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -200,7 +200,14 @@ namespace OpenSim.Services.InventoryService
200 if (folders.Length == 0) 200 if (folders.Length == 0)
201 return null; 201 return null;
202 202
203 return ConvertToOpenSim(folders[0]); 203 XInventoryFolder root = null;
204 foreach (XInventoryFolder folder in folders)
205 if (folder.folderName == "My Inventory")
206 root = folder;
207 if (folders == null) // oops
208 root = folders[0];
209
210 return ConvertToOpenSim(root);
204 } 211 }
205 212
206 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 213 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 6a2cbeb..240f5b1 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -175,6 +175,9 @@ namespace OpenSim.Services.LLLoginService
175 private string firstname; 175 private string firstname;
176 private string lastname; 176 private string lastname;
177 177
178 // Web map
179 private string mapTileURL;
180
178 // Error Flags 181 // Error Flags
179 private string errorReason; 182 private string errorReason;
180 private string errorMessage; 183 private string errorMessage;
@@ -223,7 +226,7 @@ namespace OpenSim.Services.LLLoginService
223 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 226 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
224 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 227 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
225 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 228 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
226 GridRegion home, IPEndPoint clientIP) 229 GridRegion home, IPEndPoint clientIP, string mapTileURL)
227 : this() 230 : this()
228 { 231 {
229 FillOutInventoryData(invSkel, libService); 232 FillOutInventoryData(invSkel, libService);
@@ -239,6 +242,7 @@ namespace OpenSim.Services.LLLoginService
239 Message = message; 242 Message = message;
240 BuddList = ConvertFriendListItem(friendsList); 243 BuddList = ConvertFriendListItem(friendsList);
241 StartLocation = where; 244 StartLocation = where;
245 MapTileURL = mapTileURL;
242 246
243 FillOutHomeData(pinfo, home); 247 FillOutHomeData(pinfo, home);
244 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); 248 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
@@ -411,6 +415,7 @@ namespace OpenSim.Services.LLLoginService
411 InitialOutfitHash["folder_name"] = "Nightclub Female"; 415 InitialOutfitHash["folder_name"] = "Nightclub Female";
412 InitialOutfitHash["gender"] = "female"; 416 InitialOutfitHash["gender"] = "female";
413 initialOutfit.Add(InitialOutfitHash); 417 initialOutfit.Add(InitialOutfitHash);
418 mapTileURL = String.Empty;
414 } 419 }
415 420
416 421
@@ -474,6 +479,9 @@ namespace OpenSim.Services.LLLoginService
474 responseData["region_x"] = (Int32)(RegionX); 479 responseData["region_x"] = (Int32)(RegionX);
475 responseData["region_y"] = (Int32)(RegionY); 480 responseData["region_y"] = (Int32)(RegionY);
476 481
482 if (mapTileURL != String.Empty)
483 responseData["map-server-url"] = mapTileURL;
484
477 if (m_buddyList != null) 485 if (m_buddyList != null)
478 { 486 {
479 responseData["buddy-list"] = m_buddyList.ToArray(); 487 responseData["buddy-list"] = m_buddyList.ToArray();
@@ -570,6 +578,9 @@ namespace OpenSim.Services.LLLoginService
570 map["region_x"] = OSD.FromInteger(RegionX); 578 map["region_x"] = OSD.FromInteger(RegionX);
571 map["region_y"] = OSD.FromInteger(RegionY); 579 map["region_y"] = OSD.FromInteger(RegionY);
572 580
581 if (mapTileURL != String.Empty)
582 map["map-server-url"] = OSD.FromString(mapTileURL);
583
573 if (m_buddyList != null) 584 if (m_buddyList != null)
574 { 585 {
575 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); 586 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray());
@@ -653,7 +664,7 @@ namespace OpenSim.Services.LLLoginService
653 Hashtable TempHash; 664 Hashtable TempHash;
654 foreach (InventoryFolderBase InvFolder in folders) 665 foreach (InventoryFolderBase InvFolder in folders)
655 { 666 {
656 if (InvFolder.ParentID == UUID.Zero) 667 if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory")
657 { 668 {
658 rootID = InvFolder.ID; 669 rootID = InvFolder.ID;
659 } 670 }
@@ -921,6 +932,12 @@ namespace OpenSim.Services.LLLoginService
921 set { home = value; } 932 set { home = value; }
922 } 933 }
923 934
935 public string MapTileURL
936 {
937 get { return mapTileURL; }
938 set { mapTileURL = value; }
939 }
940
924 public string Message 941 public string Message
925 { 942 {
926 get { return welcomeMessage; } 943 get { return welcomeMessage; }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 5c12a54..d27c26d 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -73,6 +73,7 @@ namespace OpenSim.Services.LLLoginService
73 protected int m_MinLoginLevel; 73 protected int m_MinLoginLevel;
74 protected string m_GatekeeperURL; 74 protected string m_GatekeeperURL;
75 protected bool m_AllowRemoteSetLoginLevel; 75 protected bool m_AllowRemoteSetLoginLevel;
76 protected string m_MapTileURL;
76 77
77 IConfig m_LoginServerConfig; 78 IConfig m_LoginServerConfig;
78 79
@@ -100,6 +101,7 @@ namespace OpenSim.Services.LLLoginService
100 m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false); 101 m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
101 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); 102 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
102 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 103 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
104 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
103 105
104 // These are required; the others aren't 106 // These are required; the others aren't
105 if (accountService == string.Empty || authService == string.Empty) 107 if (accountService == string.Empty || authService == string.Empty)
@@ -362,7 +364,7 @@ namespace OpenSim.Services.LLLoginService
362 // Finally, fill out the response and return it 364 // Finally, fill out the response and return it
363 // 365 //
364 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 366 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
365 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP); 367 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL);
366 368
367 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); 369 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
368 return response; 370 return response;