aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-10-06 17:44:59 +0100
committerMelanie2009-10-06 17:44:59 +0100
commit0374f1b144f3faf35da39e3925e8abd4b2a8bd04 (patch)
tree456d3d532c70d32564d35fc3cb9bbc81bdf08b2e
parentMake sure that keys exist in arrays before trying to access them. (diff)
parentCorrected words in error message. (diff)
downloadopensim-SC_OLD-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.zip
opensim-SC_OLD-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.gz
opensim-SC_OLD-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.bz2
opensim-SC_OLD-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.xz
Merge branch 'master' into vehicles
-rw-r--r--OpenSim/Data/MySQL/MySQLAuthenticationData.cs52
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs22
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs70
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs4
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs8
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs26
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs12
-rw-r--r--OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs5
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs14
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs7
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs2
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs75
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs7
-rw-r--r--OpenSim/Services/GridService/GridService.cs26
-rw-r--r--bin/OpenSim.ini.example4
-rw-r--r--bin/config-include/GridCommon.ini.example4
22 files changed, 253 insertions, 137 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index e96a123..0780936 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -55,39 +55,41 @@ namespace OpenSim.Data.MySQL
55 AuthenticationData ret = new AuthenticationData(); 55 AuthenticationData ret = new AuthenticationData();
56 ret.Data = new Dictionary<string, object>(); 56 ret.Data = new Dictionary<string, object>();
57 57
58 using (MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID")) 58 MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID");
59 {
60 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
61 59
62 using (IDataReader result = ExecuteReader(cmd)) 60 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
63 {
64 if (result.Read())
65 {
66 ret.PrincipalID = principalID;
67 61
68 if (m_ColumnNames == null) 62 IDataReader result = ExecuteReader(cmd);
69 {
70 m_ColumnNames = new List<string>();
71 63
72 DataTable schemaTable = result.GetSchemaTable(); 64 if (result.Read())
73 foreach (DataRow row in schemaTable.Rows) 65 {
74 m_ColumnNames.Add(row["ColumnName"].ToString()); 66 ret.PrincipalID = principalID;
75 } 67
68 if (m_ColumnNames == null)
69 {
70 m_ColumnNames = new List<string>();
76 71
77 foreach (string s in m_ColumnNames) 72 DataTable schemaTable = result.GetSchemaTable();
78 { 73 foreach (DataRow row in schemaTable.Rows)
79 if (s == "UUID") 74 m_ColumnNames.Add(row["ColumnName"].ToString());
80 continue; 75 }
81 76
82 ret.Data[s] = result[s].ToString(); 77 foreach (string s in m_ColumnNames)
83 } 78 {
79 if (s == "UUID")
80 continue;
84 81
85 return ret; 82 ret.Data[s] = result[s].ToString();
86 }
87 } 83 }
88 }
89 84
90 return null; 85 CloseDBConnection(result, cmd);
86 return ret;
87 }
88 else
89 {
90 CloseDBConnection(result, cmd);
91 return null;
92 }
91 } 93 }
92 94
93 public bool Store(AuthenticationData data) 95 public bool Store(AuthenticationData data)
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index c756c9c..ccd1ab0 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -40,14 +40,15 @@ namespace OpenSim.Data.MySQL
40 /// </summary> 40 /// </summary>
41 public class MySqlFramework 41 public class MySqlFramework
42 { 42 {
43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly log4net.ILog m_log =
44 log4net.LogManager.GetLogger(
45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44 46
45 protected MySqlConnection m_Connection; 47 protected MySqlConnection m_Connection;
46 48
47 protected MySqlFramework(string connectionString) 49 protected MySqlFramework(string connectionString)
48 { 50 {
49 m_Connection = new MySqlConnection(connectionString); 51 m_Connection = new MySqlConnection(connectionString);
50
51 m_Connection.Open(); 52 m_Connection.Open();
52 } 53 }
53 54
@@ -82,8 +83,8 @@ namespace OpenSim.Data.MySQL
82 errorSeen = true; 83 errorSeen = true;
83 84
84 m_Connection.Close(); 85 m_Connection.Close();
85 MySqlConnection newConnection = (MySqlConnection) 86 MySqlConnection newConnection =
86 ((ICloneable)m_Connection).Clone(); 87 (MySqlConnection)((ICloneable)m_Connection).Clone();
87 m_Connection.Dispose(); 88 m_Connection.Dispose();
88 m_Connection = newConnection; 89 m_Connection = newConnection;
89 m_Connection.Open(); 90 m_Connection.Open();
@@ -104,14 +105,19 @@ namespace OpenSim.Data.MySQL
104 105
105 protected IDataReader ExecuteReader(MySqlCommand cmd) 106 protected IDataReader ExecuteReader(MySqlCommand cmd)
106 { 107 {
107 MySqlConnection newConnection = (MySqlConnection) 108 MySqlConnection newConnection =
108 ((ICloneable)m_Connection).Clone(); 109 (MySqlConnection)((ICloneable)m_Connection).Clone();
109
110 newConnection.Open(); 110 newConnection.Open();
111 111
112 cmd.Connection = newConnection; 112 cmd.Connection = newConnection;
113
114 return cmd.ExecuteReader(); 113 return cmd.ExecuteReader();
115 } 114 }
115
116 protected void CloseDBConnection(IDataReader reader, MySqlCommand cmd)
117 {
118 reader.Close();
119 cmd.Connection.Close();
120 cmd.Connection.Dispose();
121 }
116 } 122 }
117} 123}
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 04b24b6..3b561d1 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -172,6 +172,8 @@ namespace OpenSim.Data.MySQL
172 172
173 retList.Add(ret); 173 retList.Add(ret);
174 } 174 }
175
176 CloseDBConnection(result, cmd);
175 } 177 }
176 178
177 return retList; 179 return retList;
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index c713a11..0bbc3f5 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -64,45 +64,47 @@ namespace OpenSim.Data.MySQL
64 if (scopeID != UUID.Zero) 64 if (scopeID != UUID.Zero)
65 command += " and ScopeID = ?scopeID"; 65 command += " and ScopeID = ?scopeID";
66 66
67 using (MySqlCommand cmd = new MySqlCommand(command)) 67 MySqlCommand cmd = new MySqlCommand(command);
68
69 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
70 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
71
72 IDataReader result = ExecuteReader(cmd);
73
74 if (result.Read())
68 { 75 {
69 cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); 76 ret.PrincipalID = principalID;
70 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 77 UUID scope;
78 UUID.TryParse(result["ScopeID"].ToString(), out scope);
79 ret.ScopeID = scope;
71 80
72 using (IDataReader result = ExecuteReader(cmd)) 81 if (m_ColumnNames == null)
73 { 82 {
74 if (result.Read()) 83 m_ColumnNames = new List<string>();
75 { 84
76 ret.PrincipalID = principalID; 85 DataTable schemaTable = result.GetSchemaTable();
77 UUID scope; 86 foreach (DataRow row in schemaTable.Rows)
78 UUID.TryParse(result["ScopeID"].ToString(), out scope); 87 m_ColumnNames.Add(row["ColumnName"].ToString());
79 ret.ScopeID = scope;
80
81 if (m_ColumnNames == null)
82 {
83 m_ColumnNames = new List<string>();
84
85 DataTable schemaTable = result.GetSchemaTable();
86 foreach (DataRow row in schemaTable.Rows)
87 m_ColumnNames.Add(row["ColumnName"].ToString());
88 }
89
90 foreach (string s in m_ColumnNames)
91 {
92 if (s == "UUID")
93 continue;
94 if (s == "ScopeID")
95 continue;
96
97 ret.Data[s] = result[s].ToString();
98 }
99
100 return ret;
101 }
102 } 88 }
103 }
104 89
105 return null; 90 foreach (string s in m_ColumnNames)
91 {
92 if (s == "UUID")
93 continue;
94 if (s == "ScopeID")
95 continue;
96
97 ret.Data[s] = result[s].ToString();
98 }
99
100 CloseDBConnection(result, cmd);
101 return ret;
102 }
103 else
104 {
105 CloseDBConnection(result, cmd);
106 return null;
107 }
106 } 108 }
107 109
108 public bool Store(UserAccountData data) 110 public bool Store(UserAccountData data)
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 7a73506..d98f47d 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -318,11 +318,11 @@ namespace OpenSim.Framework.Communications
318 HttpWebResponse errorResponse = e.Response as HttpWebResponse; 318 HttpWebResponse errorResponse = e.Response as HttpWebResponse;
319 if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode) 319 if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode)
320 { 320 {
321 m_log.Warn("[ASSET] Asset not found (404)"); 321 m_log.Warn("[REST CLIENT] Resource not found (404)");
322 } 322 }
323 else 323 else
324 { 324 {
325 m_log.Error("[ASSET] Error fetching asset from asset server"); 325 m_log.Error("[REST CLIENT] Error fetching resource from server " + _request.Address.ToString());
326 m_log.Debug(e.ToString()); 326 m_log.Debug(e.ToString());
327 } 327 }
328 328
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 632b551..56155dd 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -238,7 +238,7 @@ namespace OpenSim.Framework.Servers
238 List<Thread> threads = ThreadTracker.GetThreads(); 238 List<Thread> threads = ThreadTracker.GetThreads();
239 if (threads == null) 239 if (threads == null)
240 { 240 {
241 sb.Append("Thread tracking is only enabled in DEBUG mode."); 241 sb.Append("OpenSim thread tracking is only enabled in DEBUG mode.");
242 } 242 }
243 else 243 else
244 { 244 {
@@ -264,6 +264,12 @@ namespace OpenSim.Framework.Servers
264 } 264 }
265 } 265 }
266 } 266 }
267 int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0;
268 ThreadPool.GetAvailableThreads(out workers, out ports);
269 ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);
270
271 sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine);
272 sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine);
267 273
268 return sb.ToString(); 274 return sb.ToString();
269 } 275 }
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
index 8a490f7..4543fd5 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
@@ -28,14 +28,21 @@
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31using System.Reflection;
31using System.Text; 32using System.Text;
32using System.Xml; 33using System.Xml;
33using System.Xml.Serialization; 34using System.Xml.Serialization;
34 35
36using log4net;
37
35namespace OpenSim.Framework.Servers.HttpServer 38namespace OpenSim.Framework.Servers.HttpServer
36{ 39{
37 public class SynchronousRestFormsRequester 40 public class SynchronousRestFormsRequester
38 { 41 {
42 private static readonly ILog m_log =
43 LogManager.GetLogger(
44 MethodBase.GetCurrentMethod().DeclaringType);
45
39 /// <summary> 46 /// <summary>
40 /// Perform a synchronous REST request. 47 /// Perform a synchronous REST request.
41 /// </summary> 48 /// </summary>
@@ -72,8 +79,9 @@ namespace OpenSim.Framework.Servers.HttpServer
72 requestStream = request.GetRequestStream(); 79 requestStream = request.GetRequestStream();
73 requestStream.Write(buffer.ToArray(), 0, length); 80 requestStream.Write(buffer.ToArray(), 0, length);
74 } 81 }
75 catch 82 catch (Exception e)
76 { 83 {
84 m_log.DebugFormat("[FORMS]: exception occured on sending request {0}", e.Message);
77 } 85 }
78 finally 86 finally
79 { 87 {
@@ -102,7 +110,10 @@ namespace OpenSim.Framework.Servers.HttpServer
102 respstring = reader.ReadToEnd(); 110 respstring = reader.ReadToEnd();
103 } 111 }
104 } 112 }
105 catch { } 113 catch (Exception e)
114 {
115 m_log.DebugFormat("[FORMS]: exception occured on receiving reply {0}", e.Message);
116 }
106 finally 117 finally
107 { 118 {
108 if (respStream != null) 119 if (respStream != null)
@@ -114,6 +125,7 @@ namespace OpenSim.Framework.Servers.HttpServer
114 catch (System.InvalidOperationException) 125 catch (System.InvalidOperationException)
115 { 126 {
116 // This is what happens when there is invalid XML 127 // This is what happens when there is invalid XML
128 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
117 } 129 }
118 return respstring; 130 return respstring;
119 } 131 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 2120d33..cc290ed 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
88 J2KImage imgrequest; 88 J2KImage imgrequest;
89 89
90 // Do a linear search for this texture download 90 // Do a linear search for this texture download
91 lock (m_priorityQueue) 91 lock (m_syncRoot)
92 m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); 92 m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest);
93 93
94 if (imgrequest != null) 94 if (imgrequest != null)
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
99 99
100 try 100 try
101 { 101 {
102 lock (m_priorityQueue) 102 lock (m_syncRoot)
103 m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); 103 m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
104 } 104 }
105 catch (Exception) { } 105 catch (Exception) { }
@@ -211,7 +211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
211 { 211 {
212 J2KImage image = null; 212 J2KImage image = null;
213 213
214 lock (m_priorityQueue) 214 lock (m_syncRoot)
215 { 215 {
216 216
217 if (m_priorityQueue.Count > 0) 217 if (m_priorityQueue.Count > 0)
@@ -230,23 +230,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
230 { 230 {
231 image.PriorityQueueHandle = null; 231 image.PriorityQueueHandle = null;
232 232
233 lock (m_priorityQueue) 233 lock (m_syncRoot)
234 m_priorityQueue.Add(ref image.PriorityQueueHandle, image); 234 try
235 {
236 m_priorityQueue.Add(ref image.PriorityQueueHandle, image);
237 }
238 catch (Exception) { }
235 } 239 }
236 240
237 void RemoveImageFromQueue(J2KImage image) 241 void RemoveImageFromQueue(J2KImage image)
238 { 242 {
239 try 243 lock (m_syncRoot)
240 { 244 try
241 lock (m_priorityQueue) 245 {
242 m_priorityQueue.Delete(image.PriorityQueueHandle); 246 m_priorityQueue.Delete(image.PriorityQueueHandle);
243 } 247 }
244 catch (Exception) { } 248 catch (Exception) { }
245 } 249 }
246 250
247 void UpdateImageInQueue(J2KImage image) 251 void UpdateImageInQueue(J2KImage image)
248 { 252 {
249 lock (m_priorityQueue) 253 lock (m_syncRoot)
250 { 254 {
251 try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } 255 try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); }
252 catch (Exception) 256 catch (Exception)
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 5a5ad7e..66ca7c2 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -178,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Asset
178 { 178 {
179 if (maximalSize <= 0 || maximalCount <= 0) 179 if (maximalSize <= 0 || maximalCount <= 0)
180 { 180 {
181 Log.Info("[ASSET CACHE]: Cenome asset cache is not enabled."); 181 //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled.");
182 m_enabled = false; 182 m_enabled = false;
183 return; 183 return;
184 } 184 }
@@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Asset
194 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( 194 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
195 maximalSize, maximalCount, expirationTime)); 195 maximalSize, maximalCount, expirationTime));
196 m_enabled = true; 196 m_enabled = true;
197 Log.InfoFormat( 197 Log.DebugFormat(
198 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", 198 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})",
199 maximalSize, 199 maximalSize,
200 maximalCount, 200 maximalCount,
@@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Asset
263 263
264 if (m_getCount == m_debugEpoch) 264 if (m_getCount == m_debugEpoch)
265 { 265 {
266 Log.InfoFormat( 266 Log.DebugFormat(
267 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", 267 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes",
268 m_cachedCount, 268 m_cachedCount,
269 m_getCount, 269 m_getCount,
@@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Asset
333 return; 333 return;
334 334
335 string name = moduleConfig.GetString("AssetCaching"); 335 string name = moduleConfig.GetString("AssetCaching");
336 Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 336 //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
337 337
338 if (name != Name) 338 if (name != Name)
339 return; 339 return;
@@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Asset
343 int maxCount = DefaultMaxCount; 343 int maxCount = DefaultMaxCount;
344 TimeSpan expirationTime = DefaultExpirationTime; 344 TimeSpan expirationTime = DefaultExpirationTime;
345 345
346 IConfig assetConfig = source.Configs[ "AssetCache" ]; 346 IConfig assetConfig = source.Configs["AssetCache"];
347 if (assetConfig != null) 347 if (assetConfig != null)
348 { 348 {
349 // Get optional configurations 349 // Get optional configurations
350 maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize); 350 maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize);
351 maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount); 351 maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount);
352 expirationTime = 352 expirationTime =
353 TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int) DefaultExpirationTime.TotalMinutes)); 353 TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int)DefaultExpirationTime.TotalMinutes));
354 354
355 // Debugging purposes only 355 // Debugging purposes only
356 m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0); 356 m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0);
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 2de40d2..0a7e736 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Asset
66 if (moduleConfig != null) 66 if (moduleConfig != null)
67 { 67 {
68 string name = moduleConfig.GetString("AssetCaching"); 68 string name = moduleConfig.GetString("AssetCaching");
69 m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 69 //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
70 70
71 if (name == Name) 71 if (name == Name)
72 { 72 {
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index c0bb70c..b81ab41 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -636,11 +636,8 @@ namespace Flotsam.RegionModules.AssetCache
636 m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk"); 636 m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk");
637 637
638 } 638 }
639
640
641 } 639 }
642 640
643 #endregion 641 #endregion
644
645 } 642 }
646} 643} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 8d8e0fe..4869f5d 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Asset
68 if (moduleConfig != null) 68 if (moduleConfig != null)
69 { 69 {
70 string name = moduleConfig.GetString("AssetCaching"); 70 string name = moduleConfig.GetString("AssetCaching");
71 m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized); 71 //m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized);
72 72
73 if (name == Name) 73 if (name == Name)
74 { 74 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 3ca4882..1c72488 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -206,6 +206,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
206 206
207 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 207 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
208 { 208 {
209 GridRegion region = null;
210
211 // First see if it's a neighbour, even if it isn't on this sim.
212 // Neighbour data is cached in memory, so this is fast
213 foreach (RegionCache rcache in m_LocalCache.Values)
214 {
215 region = rcache.GetRegionByPosition(x, y);
216 if (region != null)
217 {
218 return region;
219 }
220 }
221
222 // Then try on this sim (may be a lookup in DB if this is using MySql).
209 return m_GridService.GetRegionByPosition(scopeID, x, y); 223 return m_GridService.GetRegionByPosition(scopeID, x, y);
210 } 224 }
211 225
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
index 2b336bb..44e850b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -29,10 +29,12 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31 31
32using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
34using GridRegion = OpenSim.Services.Interfaces.GridRegion; 35using GridRegion = OpenSim.Services.Interfaces.GridRegion;
35 36
37using OpenMetaverse;
36using log4net; 38using log4net;
37 39
38namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
@@ -75,5 +77,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
75 { 77 {
76 return new List<GridRegion>(m_neighbours.Values); 78 return new List<GridRegion>(m_neighbours.Values);
77 } 79 }
80
81 public GridRegion GetRegionByPosition(int x, int y)
82 {
83 uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize;
84 uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize;
85 ulong handle = Utils.UIntsToLong(xsnap, ysnap);
86
87 if (m_neighbours.ContainsKey(handle))
88 return m_neighbours[handle];
89
90 return null;
91 }
78 } 92 }
79} 93}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c06a58f..9418e3d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,6 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
137 protected IAssetService m_AssetService = null; 137 protected IAssetService m_AssetService = null;
138 protected IAuthorizationService m_AuthorizationService = null; 138 protected IAuthorizationService m_AuthorizationService = null;
139 139
140 private Object m_heartbeatLock = new Object();
141
140 public IAssetService AssetService 142 public IAssetService AssetService
141 { 143 {
142 get 144 get
@@ -942,6 +944,9 @@ namespace OpenSim.Region.Framework.Scenes
942 /// <param name="e"></param> 944 /// <param name="e"></param>
943 private void Heartbeat(object sender) 945 private void Heartbeat(object sender)
944 { 946 {
947 if (!Monitor.TryEnter(m_heartbeatLock))
948 return;
949
945 try 950 try
946 { 951 {
947 Update(); 952 Update();
@@ -952,6 +957,11 @@ namespace OpenSim.Region.Framework.Scenes
952 catch (ThreadAbortException) 957 catch (ThreadAbortException)
953 { 958 {
954 } 959 }
960 finally
961 {
962 Monitor.Pulse(m_heartbeatLock);
963 Monitor.Exit(m_heartbeatLock);
964 }
955 } 965 }
956 966
957 /// <summary> 967 /// <summary>
@@ -962,6 +972,12 @@ namespace OpenSim.Region.Framework.Scenes
962 int maintc = 0; 972 int maintc = 0;
963 while (!shuttingdown) 973 while (!shuttingdown)
964 { 974 {
975//#if DEBUG
976// int w = 0, io = 0;
977// ThreadPool.GetAvailableThreads(out w, out io);
978// if ((w < 10) || (io < 10))
979// m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io);
980//#endif
965 maintc = Environment.TickCount; 981 maintc = Environment.TickCount;
966 982
967 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate; 983 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 06bae5a..c02b123 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -3488,7 +3488,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3488 public override void UnCombine(PhysicsScene pScene) 3488 public override void UnCombine(PhysicsScene pScene)
3489 { 3489 {
3490 IntPtr localGround = IntPtr.Zero; 3490 IntPtr localGround = IntPtr.Zero;
3491 float[] localHeightfield; 3491 //float[] localHeightfield;
3492 bool proceed = false; 3492 bool proceed = false;
3493 List<IntPtr> geomDestroyList = new List<IntPtr>(); 3493 List<IntPtr> geomDestroyList = new List<IntPtr>();
3494 3494
@@ -3785,16 +3785,13 @@ namespace OpenSim.Region.Physics.OdePlugin
3785 sides.Z = 0.5f; 3785 sides.Z = 0.5f;
3786 3786
3787 ds.DrawBox(ref pos, ref R, ref sides); 3787 ds.DrawBox(ref pos, ref R, ref sides);
3788
3789
3790 } 3788 }
3791 } 3789 }
3792 } 3790 }
3793 } 3791 }
3794 3792
3795 public void start(int unused) 3793 public void start(int unused)
3796 { 3794 {
3797
3798 ds.SetViewpoint(ref xyz, ref hpr); 3795 ds.SetViewpoint(ref xyz, ref hpr);
3799 } 3796 }
3800#endif 3797#endif
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 0964caa..9d9735e 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -260,7 +260,7 @@ namespace OpenSim.Server.Base
260 260
261 public static Dictionary<string, object> ParseXmlResponse(string data) 261 public static Dictionary<string, object> ParseXmlResponse(string data)
262 { 262 {
263 //m_log.DebugFormat("[XXX]: received xml string: {0}", data); 263 m_log.DebugFormat("[XXX]: received xml string: {0}", data);
264 264
265 Dictionary<string, object> ret = new Dictionary<string, object>(); 265 Dictionary<string, object> ret = new Dictionary<string, object>();
266 266
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index e22328d..433ed0b 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -67,43 +67,50 @@ namespace OpenSim.Server.Handlers.Grid
67 67
68 //m_log.DebugFormat("[XXX]: query String: {0}", body); 68 //m_log.DebugFormat("[XXX]: query String: {0}", body);
69 69
70 Dictionary<string, string> request = 70 try
71 ServerUtils.ParseQueryString(body); 71 {
72 Dictionary<string, string> request =
73 ServerUtils.ParseQueryString(body);
72 74
73 if (!request.ContainsKey("METHOD")) 75 if (!request.ContainsKey("METHOD"))
74 return FailureResult(); 76 return FailureResult();
75 77
76 string method = request["METHOD"]; 78 string method = request["METHOD"];
77 79
78 switch (method) 80 switch (method)
79 { 81 {
80 case "register": 82 case "register":
81 return Register(request); 83 return Register(request);
82 84
83 case "deregister": 85 case "deregister":
84 return Deregister(request); 86 return Deregister(request);
85 87
86 case "get_neighbours": 88 case "get_neighbours":
87 return GetNeighbours(request); 89 return GetNeighbours(request);
88 90
89 case "get_region_by_uuid": 91 case "get_region_by_uuid":
90 return GetRegionByUUID(request); 92 return GetRegionByUUID(request);
91 93
92 case "get_region_by_position": 94 case "get_region_by_position":
93 return GetRegionByPosition(request); 95 return GetRegionByPosition(request);
94 96
95 case "get_region_by_name": 97 case "get_region_by_name":
96 return GetRegionByName(request); 98 return GetRegionByName(request);
97 99
98 case "get_regions_by_name": 100 case "get_regions_by_name":
99 return GetRegionsByName(request); 101 return GetRegionsByName(request);
100 102
101 case "get_region_range": 103 case "get_region_range":
102 return GetRegionRange(request); 104 return GetRegionRange(request);
103 105
106 }
107 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
108 }
109 catch (Exception e)
110 {
111 m_log.DebugFormat("[GRID HANDLER]: Exception {0}", e);
104 } 112 }
105 113
106 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
107 return FailureResult(); 114 return FailureResult();
108 115
109 } 116 }
@@ -113,7 +120,7 @@ namespace OpenSim.Server.Handlers.Grid
113 byte[] Register(Dictionary<string, string> request) 120 byte[] Register(Dictionary<string, string> request)
114 { 121 {
115 UUID scopeID = UUID.Zero; 122 UUID scopeID = UUID.Zero;
116 if (request["SCOPEID"] != null) 123 if (request.ContainsKey("SCOPEID"))
117 UUID.TryParse(request["SCOPEID"], out scopeID); 124 UUID.TryParse(request["SCOPEID"], out scopeID);
118 else 125 else
119 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); 126 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region");
@@ -137,11 +144,21 @@ namespace OpenSim.Server.Handlers.Grid
137 } 144 }
138 145
139 Dictionary<string, object> rinfoData = new Dictionary<string, object>(); 146 Dictionary<string, object> rinfoData = new Dictionary<string, object>();
140 foreach (KeyValuePair<string, string> kvp in request) 147 GridRegion rinfo = null;
141 rinfoData[kvp.Key] = kvp.Value; 148 try
142 GridRegion rinfo = new GridRegion(rinfoData); 149 {
150 foreach (KeyValuePair<string, string> kvp in request)
151 rinfoData[kvp.Key] = kvp.Value;
152 rinfo = new GridRegion(rinfoData);
153 }
154 catch (Exception e)
155 {
156 m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e);
157 }
143 158
144 bool result = m_GridService.RegisterRegion(scopeID, rinfo); 159 bool result = false;
160 if (rinfo != null)
161 result = m_GridService.RegisterRegion(scopeID, rinfo);
145 162
146 if (result) 163 if (result)
147 return SuccessResult(); 164 return SuccessResult();
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index ba46b0d..acdf558 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -109,8 +109,13 @@ namespace OpenSim.Services.Connectors
109 { 109 {
110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
111 111
112 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 112 if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
113 return true; 113 return true;
114 else if (!replyData.ContainsKey("Result"))
115 m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
116 else
117 m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
118
114 } 119 }
115 else 120 else
116 m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply"); 121 m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 991acf2..a2e4771 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -69,18 +69,40 @@ namespace OpenSim.Services.GridService
69 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 69 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
70 { 70 {
71 // Region reregistering in other coordinates. Delete the old entry 71 // Region reregistering in other coordinates. Delete the old entry
72 m_Database.Delete(regionInfos.RegionID); 72 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
73 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
74
75 try
76 {
77 m_Database.Delete(regionInfos.RegionID);
78 }
79 catch (Exception e)
80 {
81 m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
82 }
73 } 83 }
74 84
75 // Everything is ok, let's register 85 // Everything is ok, let's register
76 RegionData rdata = RegionInfo2RegionData(regionInfos); 86 RegionData rdata = RegionInfo2RegionData(regionInfos);
77 rdata.ScopeID = scopeID; 87 rdata.ScopeID = scopeID;
78 m_Database.Store(rdata); 88 try
89 {
90 m_Database.Store(rdata);
91 }
92 catch (Exception e)
93 {
94 m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
95 }
96
97 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
98 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
99
79 return true; 100 return true;
80 } 101 }
81 102
82 public bool DeregisterRegion(UUID regionID) 103 public bool DeregisterRegion(UUID regionID)
83 { 104 {
105 m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
84 return m_Database.Delete(regionID); 106 return m_Database.Delete(regionID);
85 } 107 }
86 108
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index fa8dc9d..5cb51b2 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -312,7 +312,7 @@
312 ; Uncomment below to enable llRemoteData/remote channels 312 ; Uncomment below to enable llRemoteData/remote channels
313 ; remoteDataPort = 20800 313 ; remoteDataPort = 20800
314 314
315 grid_server_url = "http://127.0.0.1:8001" 315 grid_server_url = "http://127.0.0.1:8003"
316 grid_send_key = "null" 316 grid_send_key = "null"
317 grid_recv_key = "null" 317 grid_recv_key = "null"
318 318
@@ -322,7 +322,7 @@
322 322
323 asset_server_url = "http://127.0.0.1:8003" 323 asset_server_url = "http://127.0.0.1:8003"
324 324
325 inventory_server_url = "http://127.0.0.1:8004" 325 inventory_server_url = "http://127.0.0.1:8003"
326 326
327 ; The MessagingServer is a companion of the UserServer. It uses 327 ; The MessagingServer is a companion of the UserServer. It uses
328 ; user_send_key and user_recv_key, too 328 ; user_send_key and user_recv_key, too
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example
index 6607a1a..3bc9b6c 100644
--- a/bin/config-include/GridCommon.ini.example
+++ b/bin/config-include/GridCommon.ini.example
@@ -13,13 +13,13 @@
13 ; 13 ;
14 ; change this to your grid-wide inventory server 14 ; change this to your grid-wide inventory server
15 ; 15 ;
16 InventoryServerURI = "http://myinventoryserver.com:8004" 16 InventoryServerURI = "http://myinventoryserver.com:8003"
17 17
18[GridService] 18[GridService]
19 ; 19 ;
20 ; change this to your grid-wide grid server 20 ; change this to your grid-wide grid server
21 ; 21 ;
22 GridServerURI = "http://mygridserver.com:8001" 22 GridServerURI = "http://mygridserver.com:8003"
23 23
24[Modules] 24[Modules]
25 ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. 25 ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.