aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-08-07 23:29:42 +0100
committerMelanie2013-08-07 23:29:42 +0100
commit005c69511dac490a8353233423a3152abf5580dd (patch)
treeabae7717af4af3ed7844f3747ab28398fdad9cdf /OpenSim
parentMerge branch 'avination-current' into careminster (diff)
parentminor: add some method doc to ScenePresence fields used for entity transfer, ... (diff)
downloadopensim-SC-005c69511dac490a8353233423a3152abf5580dd.zip
opensim-SC-005c69511dac490a8353233423a3152abf5580dd.tar.gz
opensim-SC-005c69511dac490a8353233423a3152abf5580dd.tar.bz2
opensim-SC-005c69511dac490a8353233423a3152abf5580dd.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/Framework/Scenes/Scene.Inventory.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs4
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs6
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs22
-rw-r--r--OpenSim/Framework/Monitoring/Checks/Check.cs118
-rw-r--r--OpenSim/Framework/Monitoring/ChecksManager.cs262
-rw-r--r--OpenSim/Framework/Monitoring/StatsLogger.cs108
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs58
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs1
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs154
-rw-r--r--OpenSim/Framework/WebUtil.cs16
-rw-r--r--OpenSim/Region/Application/Application.cs41
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs12
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs42
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs34
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs36
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs65
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs53
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs5
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs206
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs44
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs41
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs17
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs3
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs8
-rw-r--r--OpenSim/Tests/Clients/Assets/AssetsClient.cs14
-rw-r--r--OpenSim/Tools/Configger/ConfigurationLoader.cs1
39 files changed, 1318 insertions, 216 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index da8030c..830c671 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -467,12 +467,12 @@ namespace OpenSim.Groups
467 } 467 }
468 468
469 // Send notice out to everyone that wants notices 469 // Send notice out to everyone that wants notices
470 // Build notice IIM
471 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
472 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) 470 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
473 { 471 {
474 if (member.AcceptNotices) 472 if (member.AcceptNotices)
475 { 473 {
474 // Build notice IIM, one of reach, because the sending may be async
475 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
476 msg.toAgentID = member.AgentID.Guid; 476 msg.toAgentID = member.AgentID.Guid;
477 OutgoingInstantMessage(msg, member.AgentID); 477 OutgoingInstantMessage(msg, member.AgentID);
478 } 478 }
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 4962629..2a8e67d 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -292,6 +292,12 @@ namespace OpenSim.Framework
292 public Vector3 AtAxis; 292 public Vector3 AtAxis;
293 public Vector3 LeftAxis; 293 public Vector3 LeftAxis;
294 public Vector3 UpAxis; 294 public Vector3 UpAxis;
295
296 /// <summary>
297 /// Signal on a V2 teleport that Scene.IncomingChildAgentDataUpdate(AgentData ad) should wait for the
298 /// scene presence to become root (triggered when the viewer sends a CompleteAgentMovement UDP packet after
299 /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message).
300 /// </summary>
295 public bool SenderWantsToWaitForRoot; 301 public bool SenderWantsToWaitForRoot;
296 302
297 public float Far; 303 public float Far;
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
index 97a86a8..c0ff454 100644
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ b/OpenSim/Framework/Console/ConsoleUtil.cs
@@ -156,7 +156,27 @@ namespace OpenSim.Framework.Console
156 } 156 }
157 157
158 /// <summary> 158 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 159 /// Convert a console integer to an int, automatically complaining if a console is given.
160 /// </summary>
161 /// <param name='console'>Can be null if no console is available.</param>
162 /// <param name='rawConsoleVector'>/param>
163 /// <param name='vector'></param>
164 /// <returns></returns>
165 public static bool TryParseConsoleBool(ICommandConsole console, string rawConsoleString, out bool b)
166 {
167 if (!bool.TryParse(rawConsoleString, out b))
168 {
169 if (console != null)
170 console.OutputFormat("ERROR: {0} is not a true or false value", rawConsoleString);
171
172 return false;
173 }
174
175 return true;
176 }
177
178 /// <summary>
179 /// Convert a console integer to an int, automatically complaining if a console is given.
160 /// </summary> 180 /// </summary>
161 /// <param name='console'>Can be null if no console is available.</param> 181 /// <param name='console'>Can be null if no console is available.</param>
162 /// <param name='rawConsoleVector'>/param> 182 /// <param name='rawConsoleVector'>/param>
diff --git a/OpenSim/Framework/Monitoring/Checks/Check.cs b/OpenSim/Framework/Monitoring/Checks/Check.cs
new file mode 100644
index 0000000..594386a
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/Checks/Check.cs
@@ -0,0 +1,118 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Text;
30
31namespace OpenSim.Framework.Monitoring
32{
33 public class Check
34 {
35// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
36
37 public static readonly char[] DisallowedShortNameCharacters = { '.' };
38
39 /// <summary>
40 /// Category of this stat (e.g. cache, scene, etc).
41 /// </summary>
42 public string Category { get; private set; }
43
44 /// <summary>
45 /// Containing name for this stat.
46 /// FIXME: In the case of a scene, this is currently the scene name (though this leaves
47 /// us with a to-be-resolved problem of non-unique region names).
48 /// </summary>
49 /// <value>
50 /// The container.
51 /// </value>
52 public string Container { get; private set; }
53
54 /// <summary>
55 /// Action used to check whether alert should go off.
56 /// </summary>
57 /// <remarks>
58 /// Should return true if check passes. False otherwise.
59 /// </remarks>
60 public Func<Check, bool> CheckFunc { get; private set; }
61
62 /// <summary>
63 /// Message from the last failure, if any. If there is no message or no failure then will be null.
64 /// </summary>
65 /// <remarks>
66 /// Should be set by the CheckFunc when applicable.
67 /// </remarks>
68 public string LastFailureMessage { get; set; }
69
70 public StatVerbosity Verbosity { get; private set; }
71 public string ShortName { get; private set; }
72 public string Name { get; private set; }
73 public string Description { get; private set; }
74
75 public Check(
76 string shortName,
77 string name,
78 string description,
79 string category,
80 string container,
81 Func<Check, bool> checkFunc,
82 StatVerbosity verbosity)
83 {
84 if (ChecksManager.SubCommands.Contains(category))
85 throw new Exception(
86 string.Format("Alert cannot be in category '{0}' since this is reserved for a subcommand", category));
87
88 foreach (char c in DisallowedShortNameCharacters)
89 {
90 if (shortName.IndexOf(c) != -1)
91 throw new Exception(string.Format("Alert name {0} cannot contain character {1}", shortName, c));
92 }
93
94 ShortName = shortName;
95 Name = name;
96 Description = description;
97 Category = category;
98 Container = container;
99 CheckFunc = checkFunc;
100 Verbosity = verbosity;
101 }
102
103 public bool CheckIt()
104 {
105 return CheckFunc(this);
106 }
107
108 public virtual string ToConsoleString()
109 {
110 return string.Format(
111 "{0}.{1}.{2} - {3}",
112 Category,
113 Container,
114 ShortName,
115 Description);
116 }
117 }
118} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/ChecksManager.cs b/OpenSim/Framework/Monitoring/ChecksManager.cs
new file mode 100644
index 0000000..e4a7f8c
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/ChecksManager.cs
@@ -0,0 +1,262 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection;
32using System.Text;
33using log4net;
34
35namespace OpenSim.Framework.Monitoring
36{
37 /// <summary>
38 /// Static class used to register/deregister checks on runtime conditions.
39 /// </summary>
40 public static class ChecksManager
41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 // Subcommand used to list other stats.
45 public const string ListSubCommand = "list";
46
47 // All subcommands
48 public static HashSet<string> SubCommands = new HashSet<string> { ListSubCommand };
49
50 /// <summary>
51 /// Checks categorized by category/container/shortname
52 /// </summary>
53 /// <remarks>
54 /// Do not add or remove directly from this dictionary.
55 /// </remarks>
56 public static SortedDictionary<string, SortedDictionary<string, SortedDictionary<string, Check>>> RegisteredChecks
57 = new SortedDictionary<string, SortedDictionary<string, SortedDictionary<string, Check>>>();
58
59 public static void RegisterConsoleCommands(ICommandConsole console)
60 {
61 console.Commands.AddCommand(
62 "General",
63 false,
64 "show checks",
65 "show checks",
66 "Show checks configured for this server",
67 "If no argument is specified then info on all checks will be shown.\n"
68 + "'list' argument will show check categories.\n"
69 + "THIS FACILITY IS EXPERIMENTAL",
70 HandleShowchecksCommand);
71 }
72
73 public static void HandleShowchecksCommand(string module, string[] cmd)
74 {
75 ICommandConsole con = MainConsole.Instance;
76
77 if (cmd.Length > 2)
78 {
79 foreach (string name in cmd.Skip(2))
80 {
81 string[] components = name.Split('.');
82
83 string categoryName = components[0];
84// string containerName = components.Length > 1 ? components[1] : null;
85
86 if (categoryName == ListSubCommand)
87 {
88 con.Output("check categories available are:");
89
90 foreach (string category in RegisteredChecks.Keys)
91 con.OutputFormat(" {0}", category);
92 }
93// else
94// {
95// SortedDictionary<string, SortedDictionary<string, Check>> category;
96// if (!Registeredchecks.TryGetValue(categoryName, out category))
97// {
98// con.OutputFormat("No such category as {0}", categoryName);
99// }
100// else
101// {
102// if (String.IsNullOrEmpty(containerName))
103// {
104// OutputConfiguredToConsole(con, category);
105// }
106// else
107// {
108// SortedDictionary<string, Check> container;
109// if (category.TryGetValue(containerName, out container))
110// {
111// OutputContainerChecksToConsole(con, container);
112// }
113// else
114// {
115// con.OutputFormat("No such container {0} in category {1}", containerName, categoryName);
116// }
117// }
118// }
119// }
120 }
121 }
122 else
123 {
124 OutputAllChecksToConsole(con);
125 }
126 }
127
128 /// <summary>
129 /// Registers a statistic.
130 /// </summary>
131 /// <param name='stat'></param>
132 /// <returns></returns>
133 public static bool RegisterCheck(Check check)
134 {
135 SortedDictionary<string, SortedDictionary<string, Check>> category = null, newCategory;
136 SortedDictionary<string, Check> container = null, newContainer;
137
138 lock (RegisteredChecks)
139 {
140 // Check name is not unique across category/container/shortname key.
141 // XXX: For now just return false. This is to avoid problems in regression tests where all tests
142 // in a class are run in the same instance of the VM.
143 if (TryGetCheckParents(check, out category, out container))
144 return false;
145
146 // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
147 // This means that we don't need to lock or copy them on iteration, which will be a much more
148 // common operation after startup.
149 if (container != null)
150 newContainer = new SortedDictionary<string, Check>(container);
151 else
152 newContainer = new SortedDictionary<string, Check>();
153
154 if (category != null)
155 newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>(category);
156 else
157 newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>();
158
159 newContainer[check.ShortName] = check;
160 newCategory[check.Container] = newContainer;
161 RegisteredChecks[check.Category] = newCategory;
162 }
163
164 return true;
165 }
166
167 /// <summary>
168 /// Deregister an check
169 /// </summary>>
170 /// <param name='stat'></param>
171 /// <returns></returns>
172 public static bool DeregisterCheck(Check check)
173 {
174 SortedDictionary<string, SortedDictionary<string, Check>> category = null, newCategory;
175 SortedDictionary<string, Check> container = null, newContainer;
176
177 lock (RegisteredChecks)
178 {
179 if (!TryGetCheckParents(check, out category, out container))
180 return false;
181
182 newContainer = new SortedDictionary<string, Check>(container);
183 newContainer.Remove(check.ShortName);
184
185 newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>(category);
186 newCategory.Remove(check.Container);
187
188 newCategory[check.Container] = newContainer;
189 RegisteredChecks[check.Category] = newCategory;
190
191 return true;
192 }
193 }
194
195 public static bool TryGetCheckParents(
196 Check check,
197 out SortedDictionary<string, SortedDictionary<string, Check>> category,
198 out SortedDictionary<string, Check> container)
199 {
200 category = null;
201 container = null;
202
203 lock (RegisteredChecks)
204 {
205 if (RegisteredChecks.TryGetValue(check.Category, out category))
206 {
207 if (category.TryGetValue(check.Container, out container))
208 {
209 if (container.ContainsKey(check.ShortName))
210 return true;
211 }
212 }
213 }
214
215 return false;
216 }
217
218 public static void CheckChecks()
219 {
220 lock (RegisteredChecks)
221 {
222 foreach (SortedDictionary<string, SortedDictionary<string, Check>> category in RegisteredChecks.Values)
223 {
224 foreach (SortedDictionary<string, Check> container in category.Values)
225 {
226 foreach (Check check in container.Values)
227 {
228 if (!check.CheckIt())
229 m_log.WarnFormat(
230 "[CHECKS MANAGER]: Check {0}.{1}.{2} failed with message {3}", check.Category, check.Container, check.ShortName, check.LastFailureMessage);
231 }
232 }
233 }
234 }
235 }
236
237 private static void OutputAllChecksToConsole(ICommandConsole con)
238 {
239 foreach (var category in RegisteredChecks.Values)
240 {
241 OutputCategoryChecksToConsole(con, category);
242 }
243 }
244
245 private static void OutputCategoryChecksToConsole(
246 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Check>> category)
247 {
248 foreach (var container in category.Values)
249 {
250 OutputContainerChecksToConsole(con, container);
251 }
252 }
253
254 private static void OutputContainerChecksToConsole(ICommandConsole con, SortedDictionary<string, Check> container)
255 {
256 foreach (Check check in container.Values)
257 {
258 con.Output(check.ToConsoleString());
259 }
260 }
261 }
262} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/StatsLogger.cs b/OpenSim/Framework/Monitoring/StatsLogger.cs
new file mode 100644
index 0000000..fa2e1b6
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/StatsLogger.cs
@@ -0,0 +1,108 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using System.Timers;
31using log4net;
32
33namespace OpenSim.Framework.Monitoring
34{
35 /// <summary>
36 /// Provides a means to continuously log stats for debugging purposes.
37 /// </summary>
38 public static class StatsLogger
39 {
40 private static readonly ILog m_statsLog = LogManager.GetLogger("special.StatsLogger");
41
42 private static Timer m_loggingTimer;
43 private static int m_statsLogIntervalMs = 5000;
44
45 public static void RegisterConsoleCommands(ICommandConsole console)
46 {
47 console.Commands.AddCommand(
48 "Debug",
49 false,
50 "debug stats record",
51 "debug stats record start|stop",
52 "Control whether stats are being regularly recorded to a separate file.",
53 "For debug purposes. Experimental.",
54 HandleStatsRecordCommand);
55 }
56
57 public static void HandleStatsRecordCommand(string module, string[] cmd)
58 {
59 ICommandConsole con = MainConsole.Instance;
60
61 if (cmd.Length != 4)
62 {
63 con.Output("Usage: debug stats record start|stop");
64 return;
65 }
66
67 if (cmd[3] == "start")
68 {
69 Start();
70 con.OutputFormat("Now recording all stats very {0}ms to file", m_statsLogIntervalMs);
71 }
72 else if (cmd[3] == "stop")
73 {
74 Stop();
75 con.Output("Stopped recording stats to file.");
76 }
77 }
78
79 public static void Start()
80 {
81 if (m_loggingTimer != null)
82 Stop();
83
84 m_loggingTimer = new Timer(m_statsLogIntervalMs);
85 m_loggingTimer.AutoReset = false;
86 m_loggingTimer.Elapsed += Log;
87 m_loggingTimer.Start();
88 }
89
90 public static void Stop()
91 {
92 if (m_loggingTimer != null)
93 {
94 m_loggingTimer.Stop();
95 }
96 }
97
98 private static void Log(object sender, ElapsedEventArgs e)
99 {
100 m_statsLog.InfoFormat("*** STATS REPORT AT {0} ***", DateTime.Now);
101
102 foreach (string report in StatsManager.GetAllStatsReports())
103 m_statsLog.Info(report);
104
105 m_loggingTimer.Start();
106 }
107 }
108} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index e6a2304..c8e838c 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -35,9 +35,9 @@ using OpenMetaverse.StructuredData;
35namespace OpenSim.Framework.Monitoring 35namespace OpenSim.Framework.Monitoring
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Singleton used to provide access to statistics reporters 38 /// Static class used to register/deregister/fetch statistics
39 /// </summary> 39 /// </summary>
40 public class StatsManager 40 public static class StatsManager
41 { 41 {
42 // Subcommand used to list other stats. 42 // Subcommand used to list other stats.
43 public const string AllSubCommand = "all"; 43 public const string AllSubCommand = "all";
@@ -81,6 +81,8 @@ namespace OpenSim.Framework.Monitoring
81 + "More than one name can be given separated by spaces.\n" 81 + "More than one name can be given separated by spaces.\n"
82 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS", 82 + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
83 HandleShowStatsCommand); 83 HandleShowStatsCommand);
84
85 StatsLogger.RegisterConsoleCommands(console);
84 } 86 }
85 87
86 public static void HandleShowStatsCommand(string module, string[] cmd) 88 public static void HandleShowStatsCommand(string module, string[] cmd)
@@ -145,29 +147,55 @@ namespace OpenSim.Framework.Monitoring
145 } 147 }
146 } 148 }
147 149
148 private static void OutputAllStatsToConsole(ICommandConsole con) 150 public static List<string> GetAllStatsReports()
149 { 151 {
152 List<string> reports = new List<string>();
153
150 foreach (var category in RegisteredStats.Values) 154 foreach (var category in RegisteredStats.Values)
151 { 155 reports.AddRange(GetCategoryStatsReports(category));
152 OutputCategoryStatsToConsole(con, category); 156
153 } 157 return reports;
158 }
159
160 private static void OutputAllStatsToConsole(ICommandConsole con)
161 {
162 foreach (string report in GetAllStatsReports())
163 con.Output(report);
164 }
165
166 private static List<string> GetCategoryStatsReports(
167 SortedDictionary<string, SortedDictionary<string, Stat>> category)
168 {
169 List<string> reports = new List<string>();
170
171 foreach (var container in category.Values)
172 reports.AddRange(GetContainerStatsReports(container));
173
174 return reports;
154 } 175 }
155 176
156 private static void OutputCategoryStatsToConsole( 177 private static void OutputCategoryStatsToConsole(
157 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category) 178 ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category)
158 { 179 {
159 foreach (var container in category.Values) 180 foreach (string report in GetCategoryStatsReports(category))
160 { 181 con.Output(report);
161 OutputContainerStatsToConsole(con, container);
162 }
163 } 182 }
164 183
165 private static void OutputContainerStatsToConsole( ICommandConsole con, SortedDictionary<string, Stat> container) 184 private static List<string> GetContainerStatsReports(SortedDictionary<string, Stat> container)
166 { 185 {
186 List<string> reports = new List<string>();
187
167 foreach (Stat stat in container.Values) 188 foreach (Stat stat in container.Values)
168 { 189 reports.Add(stat.ToConsoleString());
169 con.Output(stat.ToConsoleString()); 190
170 } 191 return reports;
192 }
193
194 private static void OutputContainerStatsToConsole(
195 ICommandConsole con, SortedDictionary<string, Stat> container)
196 {
197 foreach (string report in GetContainerStatsReports(container))
198 con.Output(report);
171 } 199 }
172 200
173 // Creates an OSDMap of the format: 201 // Creates an OSDMap of the format:
@@ -257,7 +285,7 @@ namespace OpenSim.Framework.Monitoring
257// } 285// }
258 286
259 /// <summary> 287 /// <summary>
260 /// Registers a statistic. 288 /// Register a statistic.
261 /// </summary> 289 /// </summary>
262 /// <param name='stat'></param> 290 /// <param name='stat'></param>
263 /// <returns></returns> 291 /// <returns></returns>
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 69d2db5..32724ec 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -380,6 +380,7 @@ namespace OpenSim.Framework.Monitoring
380 if (MemoryWatchdog.Enabled) 380 if (MemoryWatchdog.Enabled)
381 MemoryWatchdog.Update(); 381 MemoryWatchdog.Update();
382 382
383 ChecksManager.CheckChecks();
383 StatsManager.RecordStats(); 384 StatsManager.RecordStats();
384 385
385 m_watchdogTimer.Start(); 386 m_watchdogTimer.Start();
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index eb8c9f8..7108314 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -246,7 +246,7 @@ namespace OpenSim.Framework.Servers
246 "Show thread status", HandleShow); 246 "Show thread status", HandleShow);
247 247
248 m_console.Commands.AddCommand( 248 m_console.Commands.AddCommand(
249 "General", false, "threads abort", 249 "Debug", false, "threads abort",
250 "threads abort <thread-id>", 250 "threads abort <thread-id>",
251 "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort); 251 "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
252 252
@@ -256,8 +256,32 @@ namespace OpenSim.Framework.Servers
256 "Show thread status. Synonym for \"show threads\"", 256 "Show thread status. Synonym for \"show threads\"",
257 (string module, string[] args) => Notice(GetThreadsReport())); 257 (string module, string[] args) => Notice(GetThreadsReport()));
258 258
259 m_console.Commands.AddCommand (
260 "Debug", false, "debug comms set",
261 "debug comms set serialosdreq true|false",
262 "Set comms parameters. For debug purposes.",
263 HandleDebugCommsSet);
264
265 m_console.Commands.AddCommand (
266 "Debug", false, "debug comms status",
267 "debug comms status",
268 "Show current debug comms parameters.",
269 HandleDebugCommsStatus);
270
271 m_console.Commands.AddCommand (
272 "Debug", false, "debug threadpool set",
273 "debug threadpool set worker|iocp min|max <n>",
274 "Set threadpool parameters. For debug purposes.",
275 HandleDebugThreadpoolSet);
276
277 m_console.Commands.AddCommand (
278 "Debug", false, "debug threadpool status",
279 "debug threadpool status",
280 "Show current debug threadpool parameters.",
281 HandleDebugThreadpoolStatus);
282
259 m_console.Commands.AddCommand( 283 m_console.Commands.AddCommand(
260 "General", false, "force gc", 284 "Debug", false, "force gc",
261 "force gc", 285 "force gc",
262 "Manually invoke runtime garbage collection. For debugging purposes", 286 "Manually invoke runtime garbage collection. For debugging purposes",
263 HandleForceGc); 287 HandleForceGc);
@@ -272,16 +296,142 @@ namespace OpenSim.Framework.Servers
272 "shutdown", 296 "shutdown",
273 "Quit the application", (mod, args) => Shutdown()); 297 "Quit the application", (mod, args) => Shutdown());
274 298
299 ChecksManager.RegisterConsoleCommands(m_console);
275 StatsManager.RegisterConsoleCommands(m_console); 300 StatsManager.RegisterConsoleCommands(m_console);
276 } 301 }
277 302
278 public void RegisterCommonComponents(IConfigSource configSource) 303 public void RegisterCommonComponents(IConfigSource configSource)
279 { 304 {
305 IConfig networkConfig = configSource.Configs["Network"];
306
307 if (networkConfig != null)
308 {
309 WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false);
310 }
311
280 m_serverStatsCollector = new ServerStatsCollector(); 312 m_serverStatsCollector = new ServerStatsCollector();
281 m_serverStatsCollector.Initialise(configSource); 313 m_serverStatsCollector.Initialise(configSource);
282 m_serverStatsCollector.Start(); 314 m_serverStatsCollector.Start();
283 } 315 }
284 316
317 private void HandleDebugCommsStatus(string module, string[] args)
318 {
319 Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint);
320 }
321
322 private void HandleDebugCommsSet(string module, string[] args)
323 {
324 if (args.Length != 5)
325 {
326 Notice("Usage: debug comms set serialosdreq true|false");
327 return;
328 }
329
330 if (args[3] != "serialosdreq")
331 {
332 Notice("Usage: debug comms set serialosdreq true|false");
333 return;
334 }
335
336 bool setSerializeOsdRequests;
337
338 if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests))
339 return;
340
341 WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests;
342
343 Notice("serialosdreq is now {0}", setSerializeOsdRequests);
344 }
345
346 private void HandleDebugThreadpoolStatus(string module, string[] args)
347 {
348 int workerThreads, iocpThreads;
349
350 ThreadPool.GetMinThreads(out workerThreads, out iocpThreads);
351 Notice("Min worker threads: {0}", workerThreads);
352 Notice("Min IOCP threads: {0}", iocpThreads);
353
354 ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
355 Notice("Max worker threads: {0}", workerThreads);
356 Notice("Max IOCP threads: {0}", iocpThreads);
357
358 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
359 Notice("Available worker threads: {0}", workerThreads);
360 Notice("Available IOCP threads: {0}", iocpThreads);
361 }
362
363 private void HandleDebugThreadpoolSet(string module, string[] args)
364 {
365 if (args.Length != 6)
366 {
367 Notice("Usage: debug threadpool set worker|iocp min|max <n>");
368 return;
369 }
370
371 int newThreads;
372
373 if (!ConsoleUtil.TryParseConsoleInt(m_console, args[5], out newThreads))
374 return;
375
376 string poolType = args[3];
377 string bound = args[4];
378
379 bool fail = false;
380 int workerThreads, iocpThreads;
381
382 if (poolType == "worker")
383 {
384 if (bound == "min")
385 {
386 ThreadPool.GetMinThreads(out workerThreads, out iocpThreads);
387
388 if (!ThreadPool.SetMinThreads(newThreads, iocpThreads))
389 fail = true;
390 }
391 else
392 {
393 ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
394
395 if (!ThreadPool.SetMaxThreads(newThreads, iocpThreads))
396 fail = true;
397 }
398 }
399 else
400 {
401 if (bound == "min")
402 {
403 ThreadPool.GetMinThreads(out workerThreads, out iocpThreads);
404
405 if (!ThreadPool.SetMinThreads(workerThreads, newThreads))
406 fail = true;
407 }
408 else
409 {
410 ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
411
412 if (!ThreadPool.SetMaxThreads(workerThreads, newThreads))
413 fail = true;
414 }
415 }
416
417 if (fail)
418 {
419 Notice("ERROR: Could not set {0} {1} threads to {2}", poolType, bound, newThreads);
420 }
421 else
422 {
423 int minWorkerThreads, maxWorkerThreads, minIocpThreads, maxIocpThreads;
424
425 ThreadPool.GetMinThreads(out minWorkerThreads, out minIocpThreads);
426 ThreadPool.GetMaxThreads(out maxWorkerThreads, out maxIocpThreads);
427
428 Notice("Min worker threads now {0}", minWorkerThreads);
429 Notice("Min IOCP threads now {0}", minIocpThreads);
430 Notice("Max worker threads now {0}", maxWorkerThreads);
431 Notice("Max IOCP threads now {0}", maxIocpThreads);
432 }
433 }
434
285 private void HandleForceGc(string module, string[] args) 435 private void HandleForceGc(string module, string[] args)
286 { 436 {
287 Notice("Manually invoking runtime garbage collection"); 437 Notice("Manually invoking runtime garbage collection");
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index dfa37ca..9fa93ea 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -67,6 +67,11 @@ namespace OpenSim.Framework
67 public static int RequestNumber { get; internal set; } 67 public static int RequestNumber { get; internal set; }
68 68
69 /// <summary> 69 /// <summary>
70 /// Control where OSD requests should be serialized per endpoint.
71 /// </summary>
72 public static bool SerializeOSDRequestsPerEndpoint { get; set; }
73
74 /// <summary>
70 /// this is the header field used to communicate the local request id 75 /// this is the header field used to communicate the local request id
71 /// used for performance and debugging 76 /// used for performance and debugging
72 /// </summary> 77 /// </summary>
@@ -145,9 +150,16 @@ namespace OpenSim.Framework
145 150
146 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed) 151 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed)
147 { 152 {
148 lock (EndPointLock(url)) 153 if (SerializeOSDRequestsPerEndpoint)
154 {
155 lock (EndPointLock(url))
156 {
157 return ServiceOSDRequestWorker(url, data, method, timeout, compressed);
158 }
159 }
160 else
149 { 161 {
150 return ServiceOSDRequestWorker(url,data,method,timeout,compressed); 162 return ServiceOSDRequestWorker(url, data, method, timeout, compressed);
151 } 163 }
152 } 164 }
153 165
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index e451aa8..2e155ec 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -103,26 +103,38 @@ namespace OpenSim
103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); 103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
104 104
105 // Verify the Threadpool allocates or uses enough worker and IO completion threads 105 // Verify the Threadpool allocates or uses enough worker and IO completion threads
106 // .NET 2.0 workerthreads default to 50 * numcores 106 // .NET 2.0, workerthreads default to 50 * numcores
107 // .NET 3.0 workerthreads defaults to 250 * numcores 107 // .NET 3.0, workerthreads defaults to 250 * numcores
108 // .NET 4.0 workerthreads are dynamic based on bitness and OS resources 108 // .NET 4.0, workerthreads are dynamic based on bitness and OS resources
109 // Max IO Completion threads are 1000 on all 3 CLRs. 109 // Max IO Completion threads are 1000 on all 3 CLRs
110 //
111 // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores
110 int workerThreadsMin = 500; 112 int workerThreadsMin = 500;
111 int workerThreadsMax = 1000; // may need further adjustment to match other CLR 113 int workerThreadsMax = 1000; // may need further adjustment to match other CLR
112 int iocpThreadsMin = 1000; 114 int iocpThreadsMin = 1000;
113 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR 115 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
116
117 {
118 int currentMinWorkerThreads, currentMinIocpThreads;
119 System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads);
120 m_log.InfoFormat(
121 "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads",
122 currentMinWorkerThreads, currentMinIocpThreads);
123 }
124
114 int workerThreads, iocpThreads; 125 int workerThreads, iocpThreads;
115 System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); 126 System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
116 m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads); 127 m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} max worker threads and {1} max IOCP threads", workerThreads, iocpThreads);
128
117 if (workerThreads < workerThreadsMin) 129 if (workerThreads < workerThreadsMin)
118 { 130 {
119 workerThreads = workerThreadsMin; 131 workerThreads = workerThreadsMin;
120 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to worker threads to {0}",workerThreads); 132 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to max worker threads to {0}",workerThreads);
121 } 133 }
122 if (workerThreads > workerThreadsMax) 134 if (workerThreads > workerThreadsMax)
123 { 135 {
124 workerThreads = workerThreadsMax; 136 workerThreads = workerThreadsMax;
125 m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); 137 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads);
126 } 138 }
127 139
128 // Increase the number of IOCP threads available. 140 // Increase the number of IOCP threads available.
@@ -130,22 +142,24 @@ namespace OpenSim
130 if (iocpThreads < iocpThreadsMin) 142 if (iocpThreads < iocpThreadsMin)
131 { 143 {
132 iocpThreads = iocpThreadsMin; 144 iocpThreads = iocpThreadsMin;
133 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up IO completion threads to {0}",iocpThreads); 145 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IO completion threads to {0}",iocpThreads);
134 } 146 }
135 // Make sure we don't overallocate IOCP threads and thrash system resources 147 // Make sure we don't overallocate IOCP threads and thrash system resources
136 if ( iocpThreads > iocpThreadsMax ) 148 if ( iocpThreads > iocpThreadsMax )
137 { 149 {
138 iocpThreads = iocpThreadsMax; 150 iocpThreads = iocpThreadsMax;
139 m_log.InfoFormat("[OPENSIM MAIN]: Limiting IO completion threads to {0}",iocpThreads); 151 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IO completion threads to {0}",iocpThreads);
140 } 152 }
141 // set the resulting worker and IO completion thread counts back to ThreadPool 153 // set the resulting worker and IO completion thread counts back to ThreadPool
142 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) 154 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
143 { 155 {
144 m_log.InfoFormat("[OPENSIM MAIN]: Threadpool set to {0} worker threads and {1} IO completion threads", workerThreads, iocpThreads); 156 m_log.InfoFormat(
157 "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IO completion threads",
158 workerThreads, iocpThreads);
145 } 159 }
146 else 160 else
147 { 161 {
148 m_log.Info("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); 162 m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
149 } 163 }
150 164
151 // Check if the system is compatible with OpenSimulator. 165 // Check if the system is compatible with OpenSimulator.
@@ -153,17 +167,16 @@ namespace OpenSim
153 string supported = String.Empty; 167 string supported = String.Empty;
154 if (Util.IsEnvironmentSupported(ref supported)) 168 if (Util.IsEnvironmentSupported(ref supported))
155 { 169 {
156 m_log.Info("Environment is compatible.\n"); 170 m_log.Info("[OPENSIM MAIN]: Environment is supported by OpenSimulator.");
157 } 171 }
158 else 172 else
159 { 173 {
160 m_log.Warn("Environment is unsupported (" + supported + ")\n"); 174 m_log.Warn("[OPENSIM MAIN]: Environment is not supported by OpenSimulator (" + supported + ")\n");
161 } 175 }
162 176
163 // Configure nIni aliases and localles 177 // Configure nIni aliases and localles
164 Culture.SetCurrentCulture(); 178 Culture.SetCurrentCulture();
165 179
166
167 // Validate that the user has the most basic configuration done 180 // Validate that the user has the most basic configuration done
168 // If not, offer to do the most basic configuration for them warning them along the way of the importance of 181 // If not, offer to do the most basic configuration for them warning them along the way of the importance of
169 // reading these files. 182 // reading these files.
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index fc3999f..3e93638 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -337,7 +337,6 @@ namespace OpenSim
337 config.Set("physics", "OpenDynamicsEngine"); 337 config.Set("physics", "OpenDynamicsEngine");
338 config.Set("meshing", "Meshmerizer"); 338 config.Set("meshing", "Meshmerizer");
339 config.Set("physical_prim", true); 339 config.Set("physical_prim", true);
340 config.Set("see_into_this_sim_from_neighbor", true);
341 config.Set("serverside_object_permissions", true); 340 config.Set("serverside_object_permissions", true);
342 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll"); 341 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
343 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3"); 342 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index 83144e3..575e54c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -29,6 +29,7 @@ using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32using log4net.Config; 33using log4net.Config;
33using Nini.Config; 34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
@@ -53,6 +54,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
53 [TestFixtureSetUp] 54 [TestFixtureSetUp]
54 public void FixtureInit() 55 public void FixtureInit()
55 { 56 {
57 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
58 Util.FireAndForgetMethod = FireAndForgetMethod.None;
59
56 using ( 60 using (
57 Stream resource 61 Stream resource
58 = GetType().Assembly.GetManifestResourceStream( 62 = GetType().Assembly.GetManifestResourceStream(
@@ -72,6 +76,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
72 } 76 }
73 } 77 }
74 78
79 [TestFixtureTearDown]
80 public void TearDown()
81 {
82 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
83 // threads. Possibly, later tests should be rewritten not to worry about such things.
84 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
85 }
86
75 [SetUp] 87 [SetUp]
76 public override void SetUp() 88 public override void SetUp()
77 { 89 {
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 3764685..d9b0eff 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
166 166
167 // Do Decode! 167 // Do Decode!
168 if (decode) 168 if (decode)
169 Decode(assetID, j2kData); 169 Util.FireAndForget(delegate { Decode(assetID, j2kData); });
170 } 170 }
171 } 171 }
172 172
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index e1ca6cd..62b25d0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -54,8 +54,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
54 public int DebugLevel { get; set; } 54 public int DebugLevel { get; set; }
55 55
56 /// <summary> 56 /// <summary>
57 /// Period to sleep per 100 prims in order to avoid CPU spikes when an avatar with many attachments logs in 57 /// Period to sleep per 100 prims in order to avoid CPU spikes when an avatar with many attachments logs in/changes
58 /// or many avatars with a medium levels of attachments login simultaneously. 58 /// outfit or many avatars with a medium levels of attachments login/change outfit simultaneously.
59 /// </summary> 59 /// </summary>
60 /// <remarks> 60 /// <remarks>
61 /// A value of 0 will apply no pause. The pause is specified in milliseconds. 61 /// A value of 0 will apply no pause. The pause is specified in milliseconds.
@@ -1094,7 +1094,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1094 } 1094 }
1095 1095
1096 if (tainted) 1096 if (tainted)
1097 objatt.HasGroupChanged = true; 1097 objatt.HasGroupChanged = true;
1098
1099 if (ThrottlePer100PrimsRezzed > 0)
1100 {
1101 int throttleMs = (int)Math.Round((float)objatt.PrimCount / 100 * ThrottlePer100PrimsRezzed);
1102
1103 if (DebugLevel > 0)
1104 m_log.DebugFormat(
1105 "[ATTACHMENTS MODULE]: Throttling by {0}ms after rez of {1} with {2} prims for attachment to {3} on point {4} in {5}",
1106 throttleMs, objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name);
1107
1108 Thread.Sleep(throttleMs);
1109 }
1098 1110
1099 return objatt; 1111 return objatt;
1100 } 1112 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index df95bf0..4286eef 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -693,8 +693,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
693 if (version.Equals("SIMULATION/0.2")) 693 if (version.Equals("SIMULATION/0.2"))
694 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 694 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
695 else 695 else
696 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 696 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
697
698 } 697 }
699 698
700 private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, 699 private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
@@ -703,7 +702,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
703 ulong destinationHandle = finalDestination.RegionHandle; 702 ulong destinationHandle = finalDestination.RegionHandle;
704 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 703 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
705 704
706 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Using TP V1"); 705 m_log.DebugFormat(
706 "[ENTITY TRANSFER MODULE]: Using TP V1 for {0} going from {1} to {2}",
707 sp.Name, Scene.Name, finalDestination.RegionName);
708
707 // Let's create an agent there if one doesn't exist yet. 709 // Let's create an agent there if one doesn't exist yet.
708 // NOTE: logout will always be false for a non-HG teleport. 710 // NOTE: logout will always be false for a non-HG teleport.
709 bool logout = false; 711 bool logout = false;
@@ -961,6 +963,27 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
961 return; 963 return;
962 } 964 }
963 965
966 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
967 {
968 m_interRegionTeleportCancels.Value++;
969
970 m_log.DebugFormat(
971 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
972 sp.Name, finalDestination.RegionName, sp.Scene.Name);
973
974 return;
975 }
976 else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
977 {
978 m_interRegionTeleportAborts.Value++;
979
980 m_log.DebugFormat(
981 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.",
982 sp.Name, finalDestination.RegionName, sp.Scene.Name);
983
984 return;
985 }
986
964 // Past this point we have to attempt clean up if the teleport fails, so update transfer state. 987 // Past this point we have to attempt clean up if the teleport fails, so update transfer state.
965 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 988 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
966 989
@@ -1063,20 +1086,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1063 if (!sp.DoNotCloseAfterTeleport) 1086 if (!sp.DoNotCloseAfterTeleport)
1064 { 1087 {
1065 // OK, it got this agent. Let's close everything 1088 // OK, it got this agent. Let's close everything
1066 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing in agent {0} in region {1}", sp.Name, Scene.RegionInfo.RegionName); 1089 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing in agent {0} in region {1}", sp.Name, Scene.Name);
1067 sp.CloseChildAgents(newRegionX, newRegionY); 1090 sp.CloseChildAgents(newRegionX, newRegionY);
1068 sp.Scene.IncomingCloseAgent(sp.UUID, false); 1091 sp.Scene.IncomingCloseAgent(sp.UUID, false);
1069 1092
1070 } 1093 }
1071 else 1094 else
1072 { 1095 {
1073 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {0}", sp.Name, Scene.RegionInfo.RegionName); 1096 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {0}", sp.Name, Scene.Name);
1074 sp.DoNotCloseAfterTeleport = false; 1097 sp.DoNotCloseAfterTeleport = false;
1075 } 1098 }
1076 } 1099 }
1077 else 1100 else
1101 {
1078 // now we have a child agent in this region. 1102 // now we have a child agent in this region.
1079 sp.Reset(); 1103 sp.Reset();
1104 }
1080 } 1105 }
1081 1106
1082 /// <summary> 1107 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 8f9800f..ce7ed26 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -62,6 +62,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
62 private string m_ThisGatekeeper; 62 private string m_ThisGatekeeper;
63 private bool m_RestrictInventoryAccessAbroad; 63 private bool m_RestrictInventoryAccessAbroad;
64 64
65 private bool m_bypassPermissions = true;
66
65// private bool m_Initialized = false; 67// private bool m_Initialized = false;
66 68
67 #region INonSharedRegionModule 69 #region INonSharedRegionModule
@@ -100,6 +102,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
100 } 102 }
101 else 103 else
102 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); 104 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
105
106 m_bypassPermissions = !Util.GetConfigVarFromSections<bool>(source, "serverside_object_permissions",
107 new string[] { "Startup", "Permissions" }, true);
108
103 } 109 }
104 } 110 }
105 } 111 }
@@ -114,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
114 scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; 120 scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
115 scene.EventManager.OnTeleportStart += TeleportStart; 121 scene.EventManager.OnTeleportStart += TeleportStart;
116 scene.EventManager.OnTeleportFail += TeleportFail; 122 scene.EventManager.OnTeleportFail += TeleportFail;
123
124 // We're fgoing to enforce some stricter permissions if Outbound is false
125 scene.Permissions.OnTakeObject += CanTakeObject;
126 scene.Permissions.OnTakeCopyObject += CanTakeObject;
127 scene.Permissions.OnTransferUserInventory += OnTransferUserInventory;
117 } 128 }
118 129
119 #endregion 130 #endregion
@@ -417,5 +428,36 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
417 } 428 }
418 429
419 #endregion 430 #endregion
431
432 #region Permissions
433
434 private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
435 {
436 if (m_bypassPermissions) return true;
437
438 if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer))
439 {
440 SceneObjectGroup sog = null;
441 if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer)
442 return true;
443
444 return false;
445 }
446
447 return true;
448 }
449
450 private bool OnTransferUserInventory(UUID itemID, UUID userID, UUID recipientID)
451 {
452 if (m_bypassPermissions) return true;
453
454 if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(recipientID))
455 return false;
456
457 return true;
458 }
459
460
461 #endregion
420 } 462 }
421} \ No newline at end of file 463} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index aa00145..89bb037 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -809,7 +809,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
809 } 809 }
810 810
811 objlist.Add(g); 811 objlist.Add(g);
812 veclist.Add(new Vector3(0, 0, 0)); 812 veclist.Add(Vector3.Zero);
813 813
814 float offsetHeight = 0; 814 float offsetHeight = 0;
815 pos = m_Scene.GetNewRezLocation( 815 pos = m_Scene.GetNewRezLocation(
diff --git a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index fccf053..bb304df 100644
--- a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
163 163
164 public void RegisterScriptInvocation(object target, MethodInfo mi) 164 public void RegisterScriptInvocation(object target, MethodInfo mi)
165 { 165 {
166 m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name); 166// m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name);
167 167
168 Type delegateType; 168 Type delegateType;
169 List<Type> typeArgs = mi.GetParameters() 169 List<Type> typeArgs = mi.GetParameters()
@@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
325 /// </summary> 325 /// </summary>
326 public void RegisterConstant(string cname, object value) 326 public void RegisterConstant(string cname, object value)
327 { 327 {
328 m_log.DebugFormat("[MODULE COMMANDS] register constant <{0}> with value {1}",cname,value.ToString()); 328// m_log.DebugFormat("[MODULE COMMANDS] register constant <{0}> with value {1}",cname,value.ToString());
329 lock (m_constants) 329 lock (m_constants)
330 { 330 {
331 m_constants.Add(cname,value); 331 m_constants.Add(cname,value);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index a5adc29..a9aa73c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -63,35 +63,41 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
63 /// </summary> 63 /// </summary>
64 private bool m_ModuleEnabled = false; 64 private bool m_ModuleEnabled = false;
65 65
66 public LocalSimulationConnectorModule()
67 {
68 ServiceVersion = "SIMULATION/0.2";
69 }
70
71 #region Region Module interface 66 #region Region Module interface
72 67
73 public void Initialise(IConfigSource config) 68 public void Initialise(IConfigSource configSource)
74 { 69 {
75 IConfig moduleConfig = config.Configs["Modules"]; 70 IConfig moduleConfig = configSource.Configs["Modules"];
76 if (moduleConfig != null) 71 if (moduleConfig != null)
77 { 72 {
78 string name = moduleConfig.GetString("SimulationServices", ""); 73 string name = moduleConfig.GetString("SimulationServices", "");
79 if (name == Name) 74 if (name == Name)
80 { 75 {
81 //IConfig userConfig = config.Configs["SimulationService"]; 76 InitialiseService(configSource);
82 //if (userConfig == null)
83 //{
84 // m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
85 // return;
86 //}
87 77
88 m_ModuleEnabled = true; 78 m_ModuleEnabled = true;
89 79
90 m_log.Info("[SIMULATION CONNECTOR]: Local simulation enabled"); 80 m_log.Info("[LOCAL SIMULATION CONNECTOR]: Local simulation enabled.");
91 } 81 }
92 } 82 }
93 } 83 }
94 84
85 public void InitialiseService(IConfigSource configSource)
86 {
87 ServiceVersion = "SIMULATION/0.2";
88 IConfig config = configSource.Configs["SimulationService"];
89 if (config != null)
90 {
91 ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion);
92
93 if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2")
94 throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion));
95
96 m_log.InfoFormat(
97 "[LOCAL SIMULATION CONNECTOR]: Initialzied with connector protocol version {0}", ServiceVersion);
98 }
99 }
100
95 public void PostInitialise() 101 public void PostInitialise()
96 { 102 {
97 } 103 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index a1ab3e3..8bd1d10 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -50,9 +50,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteSimulationConnectorModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteSimulationConnectorModule")]
51 public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService 51 public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService
52 { 52 {
53 private bool initialized = false;
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 54
55 private bool initialized = false;
56 protected bool m_enabled = false; 56 protected bool m_enabled = false;
57 protected Scene m_aScene; 57 protected Scene m_aScene;
58 // RemoteSimulationConnector does not care about local regions; it delegates that to the Local module 58 // RemoteSimulationConnector does not care about local regions; it delegates that to the Local module
@@ -64,27 +64,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
64 64
65 #region Region Module interface 65 #region Region Module interface
66 66
67 public virtual void Initialise(IConfigSource config) 67 public virtual void Initialise(IConfigSource configSource)
68 { 68 {
69 69 IConfig moduleConfig = configSource.Configs["Modules"];
70 IConfig moduleConfig = config.Configs["Modules"];
71 if (moduleConfig != null) 70 if (moduleConfig != null)
72 { 71 {
73 string name = moduleConfig.GetString("SimulationServices", ""); 72 string name = moduleConfig.GetString("SimulationServices", "");
74 if (name == Name) 73 if (name == Name)
75 { 74 {
76 //IConfig userConfig = config.Configs["SimulationService"]; 75 m_localBackend = new LocalSimulationConnectorModule();
77 //if (userConfig == null) 76
78 //{ 77 m_localBackend.InitialiseService(configSource);
79 // m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
80 // return;
81 //}
82 78
83 m_remoteConnector = new SimulationServiceConnector(); 79 m_remoteConnector = new SimulationServiceConnector();
84 80
85 m_enabled = true; 81 m_enabled = true;
86 82
87 m_log.Info("[SIMULATION CONNECTOR]: Remote simulation enabled"); 83 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Remote simulation enabled.");
88 } 84 }
89 } 85 }
90 } 86 }
@@ -142,8 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
142 } 138 }
143 139
144 protected virtual void InitOnce(Scene scene) 140 protected virtual void InitOnce(Scene scene)
145 { 141 {
146 m_localBackend = new LocalSimulationConnectorModule();
147 m_aScene = scene; 142 m_aScene = scene;
148 //m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService); 143 //m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService);
149 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); 144 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 8f6073a..550ab87 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -551,6 +551,9 @@ namespace OpenSim.Region.Framework.Scenes
551 { 551 {
552 //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); 552 //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
553 553
554 if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient))
555 return null;
556
554 InventoryItemBase item = new InventoryItemBase(itemId, senderId); 557 InventoryItemBase item = new InventoryItemBase(itemId, senderId);
555 item = InventoryService.GetItem(item); 558 item = InventoryService.GetItem(item);
556 559
@@ -2127,7 +2130,10 @@ namespace OpenSim.Region.Framework.Scenes
2127 { 2130 {
2128 // If we don't have permission, stop right here 2131 // If we don't have permission, stop right here
2129 if (!permissionToTakeCopy) 2132 if (!permissionToTakeCopy)
2133 {
2134 remoteClient.SendAlertMessage("You don't have permission to take the object");
2130 return; 2135 return;
2136 }
2131 2137
2132 permissionToTake = true; 2138 permissionToTake = true;
2133 // Don't delete 2139 // Don't delete
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0d9028c..aa09092 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4174,28 +4174,29 @@ namespace OpenSim.Region.Framework.Scenes
4174 } 4174 }
4175 } 4175 }
4176 4176
4177 if (RegionInfo.EstateSettings != null)
4178 {
4179 if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0))
4180 {
4181 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
4182 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
4183 reason = String.Format("Denied access to region {0}: You have been banned from that region.",
4184 RegionInfo.RegionName);
4185 return false;
4186 }
4187 }
4188 else
4189 {
4190 m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!");
4191 }
4192
4193 // We only test the things below when we want to cut off 4177 // We only test the things below when we want to cut off
4194 // child agents from being present in the scene for which their root 4178 // child agents from being present in the scene for which their root
4195 // agent isn't allowed. Otherwise, we allow child agents. The test for 4179 // agent isn't allowed. Otherwise, we allow child agents. The test for
4196 // the root is done elsewhere (QueryAccess) 4180 // the root is done elsewhere (QueryAccess)
4197 if (!bypassAccessControl) 4181 if (!bypassAccessControl)
4198 { 4182 {
4183 if (RegionInfo.EstateSettings != null)
4184 {
4185 int flags = GetUserFlags(agent.AgentID);
4186 if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, flags))
4187 {
4188 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
4189 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
4190 reason = String.Format("Denied access to region {0}: You have been banned from that region.",
4191 RegionInfo.RegionName);
4192 return false;
4193 }
4194 }
4195 else
4196 {
4197 m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!");
4198 }
4199
4199 List<UUID> agentGroups = new List<UUID>(); 4200 List<UUID> agentGroups = new List<UUID>();
4200 4201
4201 if (m_groupsModule != null) 4202 if (m_groupsModule != null)
@@ -4392,36 +4393,42 @@ namespace OpenSim.Region.Framework.Scenes
4392 } 4393 }
4393 4394
4394 // We have to wait until the viewer contacts this region 4395 // We have to wait until the viewer contacts this region
4395 // after receiving the EnableSimulator HTTP Event Queue message. This triggers the viewer to send 4396 // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol)
4397 // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send
4396 // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. 4398 // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence.
4397 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 4399 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID);
4398 4400
4399 if (childAgentUpdate != null) 4401 if (sp != null)
4400 { 4402 {
4401 if (cAgentData.SessionID != childAgentUpdate.ControllingClient.SessionId) 4403 if (cAgentData.SessionID != sp.ControllingClient.SessionId)
4402 { 4404 {
4403 m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", childAgentUpdate.UUID, cAgentData.SessionID); 4405 m_log.WarnFormat(
4406 "[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).",
4407 sp.UUID, cAgentData.SessionID);
4408
4404 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}", 4409 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
4405 childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID)); 4410 sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID));
4406 } 4411 }
4407 4412
4408 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4413 sp.ChildAgentDataUpdate(cAgentData);
4409 4414
4410 int ntimes = 20; 4415 int ntimes = 20;
4411 if (cAgentData.SenderWantsToWaitForRoot) 4416 if (cAgentData.SenderWantsToWaitForRoot)
4412 { 4417 {
4413 while (childAgentUpdate.IsChildAgent && ntimes-- > 0) 4418 while (sp.IsChildAgent && ntimes-- > 0)
4414 Thread.Sleep(1000); 4419 Thread.Sleep(1000);
4415 4420
4416 m_log.DebugFormat( 4421 m_log.DebugFormat(
4417 "[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits", 4422 "[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits",
4418 childAgentUpdate.Name, childAgentUpdate.UUID, childAgentUpdate.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 20 - ntimes); 4423 sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", Name, 20 - ntimes);
4419 4424
4420 if (childAgentUpdate.IsChildAgent) 4425 if (sp.IsChildAgent)
4421 return false; 4426 return false;
4422 } 4427 }
4428
4423 return true; 4429 return true;
4424 } 4430 }
4431
4425 return false; 4432 return false;
4426 } 4433 }
4427 4434
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c4876b3..48bf6f3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -294,10 +294,24 @@ namespace OpenSim.Region.Framework.Scenes
294 /// </summary> 294 /// </summary>
295 private Vector3 posLastSignificantMove; 295 private Vector3 posLastSignificantMove;
296 296
297 // For teleports and crossings callbacks 297 #region For teleports and crossings callbacks
298
299 /// <summary>
300 /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address.
301 /// </summary>
298 string m_callbackURI; 302 string m_callbackURI;
303
299 UUID m_originRegionID; 304 UUID m_originRegionID;
300 305
306 /// <summary>
307 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
308 /// teleport is reusing the connection.
309 /// </summary>
310 /// <remarks>May be refactored or move somewhere else soon.</remarks>
311 public bool DoNotCloseAfterTeleport { get; set; }
312
313 #endregion
314
301 /// <value> 315 /// <value>
302 /// Script engines present in the scene 316 /// Script engines present in the scene
303 /// </value> 317 /// </value>
@@ -764,13 +778,6 @@ namespace OpenSim.Region.Framework.Scenes
764 } 778 }
765 } 779 }
766 780
767 /// <summary>
768 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
769 /// teleport is reusing the connection.
770 /// </summary>
771 /// <remarks>May be refactored or move somewhere else soon.</remarks>
772 public bool DoNotCloseAfterTeleport { get; set; }
773
774 private float m_speedModifier = 1.0f; 781 private float m_speedModifier = 1.0f;
775 782
776 public float SpeedModifier 783 public float SpeedModifier
@@ -1516,14 +1523,14 @@ namespace OpenSim.Region.Framework.Scenes
1516 int count = 20; 1523 int count = 20;
1517 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0) 1524 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0)
1518 { 1525 {
1519 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.RegionInfo.RegionName); 1526 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name);
1520 Thread.Sleep(200); 1527 Thread.Sleep(200);
1521 } 1528 }
1522 1529
1523 if (m_originRegionID.Equals(UUID.Zero)) 1530 if (m_originRegionID.Equals(UUID.Zero))
1524 { 1531 {
1525 // Movement into region will fail 1532 // Movement into region will fail
1526 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived", client.Name); 1533 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name);
1527 return false; 1534 return false;
1528 } 1535 }
1529 1536
@@ -1829,8 +1836,14 @@ namespace OpenSim.Region.Framework.Scenes
1829 // Here's where you get them. 1836 // Here's where you get them.
1830 m_AgentControlFlags = flags; 1837 m_AgentControlFlags = flags;
1831 m_headrotation = agentData.HeadRotation; 1838 m_headrotation = agentData.HeadRotation;
1839 byte oldState = State;
1832 State = agentData.State; 1840 State = agentData.State;
1833 1841
1842 // We need to send this back to the client in order to stop the edit beams
1843 if ((oldState & (uint)AgentState.Editing) != 0 && State == (uint)AgentState.None)
1844 ControllingClient.SendAgentTerseUpdate(this);
1845
1846
1834 PhysicsActor actor = PhysicsActor; 1847 PhysicsActor actor = PhysicsActor;
1835 if (actor == null) 1848 if (actor == null)
1836 { 1849 {
@@ -3199,8 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes
3199 } 3212 }
3200 3213
3201 // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m 3214 // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
3202 if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance || 3215 if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance)
3203 Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance)
3204 { 3216 {
3205 m_lastChildAgentUpdatePosition = AbsolutePosition; 3217 m_lastChildAgentUpdatePosition = AbsolutePosition;
3206 m_lastChildAgentUpdateCamPosition = CameraPosition; 3218 m_lastChildAgentUpdateCamPosition = CameraPosition;
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
index 0cbc5f9..d1d318c 100755
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
@@ -49,10 +49,20 @@ public class ExtendedPhysics : INonSharedRegionModule
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private static string LogHeader = "[EXTENDED PHYSICS]"; 50 private static string LogHeader = "[EXTENDED PHYSICS]";
51 51
52 // =============================================================
52 // Since BulletSim is a plugin, this these values aren't defined easily in one place. 53 // Since BulletSim is a plugin, this these values aren't defined easily in one place.
53 // This table must coorespond to an identical table in BSScene. 54 // This table must correspond to an identical table in BSScene.
55
56 // Per scene functions. See BSScene.
57
58 // Per avatar functions. See BSCharacter.
59
60 // Per prim functions. See BSPrim.
61 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
54 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; 62 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
55 63
64 // =============================================================
65
56 private IConfig Configuration { get; set; } 66 private IConfig Configuration { get; set; }
57 private bool Enabled { get; set; } 67 private bool Enabled { get; set; }
58 private Scene BaseScene { get; set; } 68 private Scene BaseScene { get; set; }
@@ -123,6 +133,7 @@ public class ExtendedPhysics : INonSharedRegionModule
123 133
124 // Register as LSL functions all the [ScriptInvocation] marked methods. 134 // Register as LSL functions all the [ScriptInvocation] marked methods.
125 Comms.RegisterScriptInvocations(this); 135 Comms.RegisterScriptInvocations(this);
136 Comms.RegisterConstants(this);
126 137
127 // When an object is modified, we might need to update its extended physics parameters 138 // When an object is modified, we might need to update its extended physics parameters
128 BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; 139 BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
@@ -136,7 +147,6 @@ public class ExtendedPhysics : INonSharedRegionModule
136 147
137 private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) 148 private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
138 { 149 {
139 throw new NotImplementedException();
140 } 150 }
141 151
142 // Event generated when some property of a prim changes. 152 // Event generated when some property of a prim changes.
@@ -168,9 +178,11 @@ public class ExtendedPhysics : INonSharedRegionModule
168 public static int PHYS_LINKSET_TYPE_MANUAL = 2; 178 public static int PHYS_LINKSET_TYPE_MANUAL = 2;
169 179
170 [ScriptInvocation] 180 [ScriptInvocation]
171 public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) 181 public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType)
172 { 182 {
173 if (!Enabled) return; 183 int ret = -1;
184
185 if (!Enabled) return ret;
174 186
175 // The part that is requesting the change. 187 // The part that is requesting the change.
176 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); 188 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
@@ -186,7 +198,7 @@ public class ExtendedPhysics : INonSharedRegionModule
186 Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; 198 Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor;
187 if (rootPhysActor != null) 199 if (rootPhysActor != null)
188 { 200 {
189 rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); 201 ret = (int)rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType);
190 } 202 }
191 else 203 else
192 { 204 {
@@ -204,6 +216,49 @@ public class ExtendedPhysics : INonSharedRegionModule
204 { 216 {
205 m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); 217 m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
206 } 218 }
219 return ret;
220 }
221
222 [ScriptInvocation]
223 public int physGetLinksetType(UUID hostID, UUID scriptID)
224 {
225 int ret = -1;
226
227 if (!Enabled) return ret;
228
229 // The part that is requesting the change.
230 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
231
232 if (requestingPart != null)
233 {
234 // The type is is always on the root of a linkset.
235 SceneObjectGroup containingGroup = requestingPart.ParentGroup;
236 SceneObjectPart rootPart = containingGroup.RootPart;
237
238 if (rootPart != null)
239 {
240 Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor;
241 if (rootPhysActor != null)
242 {
243 ret = (int)rootPhysActor.Extension(PhysFunctGetLinksetType);
244 }
245 else
246 {
247 m_log.WarnFormat("{0} physGetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}",
248 LogHeader, rootPart.Name, hostID);
249 }
250 }
251 else
252 {
253 m_log.WarnFormat("{0} physGetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}",
254 LogHeader, requestingPart.Name, hostID);
255 }
256 }
257 else
258 {
259 m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
260 }
261 return ret;
207 } 262 }
208} 263}
209} 264}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 7f94666..3afd52e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -70,6 +70,17 @@ public abstract class BSLinkset
70 return ret; 70 return ret;
71 } 71 }
72 72
73 public class BSLinkInfo
74 {
75 public BSPrimLinkable member;
76 public BSLinkInfo(BSPrimLinkable pMember)
77 {
78 member = pMember;
79 }
80 }
81
82 public LinksetImplementation LinksetImpl { get; protected set; }
83
73 public BSPrimLinkable LinksetRoot { get; protected set; } 84 public BSPrimLinkable LinksetRoot { get; protected set; }
74 85
75 protected BSScene m_physicsScene { get; private set; } 86 protected BSScene m_physicsScene { get; private set; }
@@ -78,7 +89,8 @@ public abstract class BSLinkset
78 public int LinksetID { get; private set; } 89 public int LinksetID { get; private set; }
79 90
80 // The children under the root in this linkset. 91 // The children under the root in this linkset.
81 protected HashSet<BSPrimLinkable> m_children; 92 // protected HashSet<BSPrimLinkable> m_children;
93 protected Dictionary<BSPrimLinkable, BSLinkInfo> m_children;
82 94
83 // We lock the diddling of linkset classes to prevent any badness. 95 // We lock the diddling of linkset classes to prevent any badness.
84 // This locks the modification of the instances of this class. Changes 96 // This locks the modification of the instances of this class. Changes
@@ -109,7 +121,7 @@ public abstract class BSLinkset
109 m_nextLinksetID = 1; 121 m_nextLinksetID = 1;
110 m_physicsScene = scene; 122 m_physicsScene = scene;
111 LinksetRoot = parent; 123 LinksetRoot = parent;
112 m_children = new HashSet<BSPrimLinkable>(); 124 m_children = new Dictionary<BSPrimLinkable, BSLinkInfo>();
113 LinksetMass = parent.RawMass; 125 LinksetMass = parent.RawMass;
114 Rebuilding = false; 126 Rebuilding = false;
115 127
@@ -170,17 +182,7 @@ public abstract class BSLinkset
170 bool ret = false; 182 bool ret = false;
171 lock (m_linksetActivityLock) 183 lock (m_linksetActivityLock)
172 { 184 {
173 ret = m_children.Contains(child); 185 ret = m_children.ContainsKey(child);
174 /* Safer version but the above should work
175 foreach (BSPrimLinkable bp in m_children)
176 {
177 if (child.LocalID == bp.LocalID)
178 {
179 ret = true;
180 break;
181 }
182 }
183 */
184 } 186 }
185 return ret; 187 return ret;
186 } 188 }
@@ -194,7 +196,24 @@ public abstract class BSLinkset
194 lock (m_linksetActivityLock) 196 lock (m_linksetActivityLock)
195 { 197 {
196 action(LinksetRoot); 198 action(LinksetRoot);
197 foreach (BSPrimLinkable po in m_children) 199 foreach (BSPrimLinkable po in m_children.Keys)
200 {
201 if (action(po))
202 break;
203 }
204 }
205 return ret;
206 }
207
208 // Perform an action on each member of the linkset including root prim.
209 // Depends on the action on whether this should be done at taint time.
210 public delegate bool ForEachLinkInfoAction(BSLinkInfo obj);
211 public virtual bool ForEachLinkInfo(ForEachLinkInfoAction action)
212 {
213 bool ret = false;
214 lock (m_linksetActivityLock)
215 {
216 foreach (BSLinkInfo po in m_children.Values)
198 { 217 {
199 if (action(po)) 218 if (action(po))
200 break; 219 break;
@@ -364,7 +383,7 @@ public abstract class BSLinkset
364 { 383 {
365 lock (m_linksetActivityLock) 384 lock (m_linksetActivityLock)
366 { 385 {
367 foreach (BSPrimLinkable bp in m_children) 386 foreach (BSPrimLinkable bp in m_children.Keys)
368 { 387 {
369 mass += bp.RawMass; 388 mass += bp.RawMass;
370 } 389 }
@@ -382,7 +401,7 @@ public abstract class BSLinkset
382 com = LinksetRoot.Position * LinksetRoot.RawMass; 401 com = LinksetRoot.Position * LinksetRoot.RawMass;
383 float totalMass = LinksetRoot.RawMass; 402 float totalMass = LinksetRoot.RawMass;
384 403
385 foreach (BSPrimLinkable bp in m_children) 404 foreach (BSPrimLinkable bp in m_children.Keys)
386 { 405 {
387 com += bp.Position * bp.RawMass; 406 com += bp.Position * bp.RawMass;
388 totalMass += bp.RawMass; 407 totalMass += bp.RawMass;
@@ -401,7 +420,7 @@ public abstract class BSLinkset
401 { 420 {
402 com = LinksetRoot.Position; 421 com = LinksetRoot.Position;
403 422
404 foreach (BSPrimLinkable bp in m_children) 423 foreach (BSPrimLinkable bp in m_children.Keys)
405 { 424 {
406 com += bp.Position; 425 com += bp.Position;
407 } 426 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 6359046..085d195 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -42,6 +42,7 @@ public sealed class BSLinksetCompound : BSLinkset
42 public BSLinksetCompound(BSScene scene, BSPrimLinkable parent) 42 public BSLinksetCompound(BSScene scene, BSPrimLinkable parent)
43 : base(scene, parent) 43 : base(scene, parent)
44 { 44 {
45 LinksetImpl = LinksetImplementation.Compound;
45 } 46 }
46 47
47 // ================================================================ 48 // ================================================================
@@ -257,7 +258,7 @@ public sealed class BSLinksetCompound : BSLinkset
257 { 258 {
258 if (!HasChild(child)) 259 if (!HasChild(child))
259 { 260 {
260 m_children.Add(child); 261 m_children.Add(child, new BSLinkInfo(child));
261 262
262 DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); 263 DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
263 264
@@ -353,7 +354,7 @@ public sealed class BSLinksetCompound : BSLinkset
353 354
354 // Add the shapes of all the components of the linkset 355 // Add the shapes of all the components of the linkset
355 int memberIndex = 1; 356 int memberIndex = 1;
356 ForEachMember(delegate(BSPrimLinkable cPrim) 357 ForEachMember((cPrim) =>
357 { 358 {
358 if (IsRoot(cPrim)) 359 if (IsRoot(cPrim))
359 { 360 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index f17d698..4bac222 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -36,8 +36,78 @@ public sealed class BSLinksetConstraints : BSLinkset
36{ 36{
37 // private static string LogHeader = "[BULLETSIM LINKSET CONSTRAINTS]"; 37 // private static string LogHeader = "[BULLETSIM LINKSET CONSTRAINTS]";
38 38
39 public class BSLinkInfoConstraint : BSLinkInfo
40 {
41 public ConstraintType constraintType;
42 public BSConstraint constraint;
43 public OMV.Vector3 linearLimitLow;
44 public OMV.Vector3 linearLimitHigh;
45 public OMV.Vector3 angularLimitLow;
46 public OMV.Vector3 angularLimitHigh;
47 public bool useFrameOffset;
48 public bool enableTransMotor;
49 public float transMotorMaxVel;
50 public float transMotorMaxForce;
51 public float cfm;
52 public float erp;
53 public float solverIterations;
54
55 public BSLinkInfoConstraint(BSPrimLinkable pMember)
56 : base(pMember)
57 {
58 constraint = null;
59 ResetToFixedConstraint();
60 }
61
62 // Set all the parameters for this constraint to a fixed, non-movable constraint.
63 public void ResetToFixedConstraint()
64 {
65 constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
66 linearLimitLow = OMV.Vector3.Zero;
67 linearLimitHigh = OMV.Vector3.Zero;
68 angularLimitLow = OMV.Vector3.Zero;
69 angularLimitHigh = OMV.Vector3.Zero;
70 useFrameOffset = BSParam.LinkConstraintUseFrameOffset;
71 enableTransMotor = BSParam.LinkConstraintEnableTransMotor;
72 transMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
73 transMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
74 cfm = BSParam.LinkConstraintCFM;
75 erp = BSParam.LinkConstraintERP;
76 solverIterations = BSParam.LinkConstraintSolverIterations;
77 }
78
79 // Given a constraint, apply the current constraint parameters to same.
80 public void SetConstraintParameters(BSConstraint constrain)
81 {
82 switch (constraintType)
83 {
84 case ConstraintType.D6_CONSTRAINT_TYPE:
85 BSConstraint6Dof constrain6dof = constrain as BSConstraint6Dof;
86 if (constrain6dof != null)
87 {
88 // zero linear and angular limits makes the objects unable to move in relation to each other
89 constrain6dof.SetLinearLimits(linearLimitLow, linearLimitHigh);
90 constrain6dof.SetAngularLimits(angularLimitLow, angularLimitHigh);
91
92 // tweek the constraint to increase stability
93 constrain6dof.UseFrameOffset(useFrameOffset);
94 constrain6dof.TranslationalLimitMotor(enableTransMotor, transMotorMaxVel, transMotorMaxForce);
95 constrain6dof.SetCFMAndERP(cfm, erp);
96 if (solverIterations != 0f)
97 {
98 constrain6dof.SetSolverIterations(solverIterations);
99 }
100 }
101 break;
102 default:
103 break;
104 }
105 }
106 }
107
39 public BSLinksetConstraints(BSScene scene, BSPrimLinkable parent) : base(scene, parent) 108 public BSLinksetConstraints(BSScene scene, BSPrimLinkable parent) : base(scene, parent)
40 { 109 {
110 LinksetImpl = LinksetImplementation.Constraint;
41 } 111 }
42 112
43 // When physical properties are changed the linkset needs to recalculate 113 // When physical properties are changed the linkset needs to recalculate
@@ -142,7 +212,7 @@ public sealed class BSLinksetConstraints : BSLinkset
142 { 212 {
143 if (!HasChild(child)) 213 if (!HasChild(child))
144 { 214 {
145 m_children.Add(child); 215 m_children.Add(child, new BSLinkInfoConstraint(child));
146 216
147 DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); 217 DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
148 218
@@ -190,73 +260,74 @@ public sealed class BSLinksetConstraints : BSLinkset
190 } 260 }
191 261
192 // Create a static constraint between the two passed objects 262 // Create a static constraint between the two passed objects
193 private BSConstraint BuildConstraint(BSPrimLinkable rootPrim, BSPrimLinkable childPrim) 263 private BSConstraint BuildConstraint(BSPrimLinkable rootPrim, BSLinkInfo li)
194 { 264 {
265 BSLinkInfoConstraint liConstraint = li as BSLinkInfoConstraint;
266 if (liConstraint == null)
267 return null;
268
195 // Zero motion for children so they don't interpolate 269 // Zero motion for children so they don't interpolate
196 childPrim.ZeroMotion(true); 270 li.member.ZeroMotion(true);
197
198 // Relative position normalized to the root prim
199 // Essentually a vector pointing from center of rootPrim to center of childPrim
200 OMV.Vector3 childRelativePosition = childPrim.Position - rootPrim.Position;
201
202 // real world coordinate of midpoint between the two objects
203 OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2);
204
205 DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}",
206 rootPrim.LocalID,
207 rootPrim.LocalID, rootPrim.PhysBody.AddrString,
208 childPrim.LocalID, childPrim.PhysBody.AddrString,
209 rootPrim.Position, childPrim.Position, midPoint);
210
211 // create a constraint that allows no freedom of movement between the two objects
212 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
213
214 BSConstraint6Dof constrain = new BSConstraint6Dof(
215 m_physicsScene.World, rootPrim.PhysBody, childPrim.PhysBody, midPoint, true, true );
216 // PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true );
217
218 /* NOTE: below is an attempt to build constraint with full frame computation, etc.
219 * Using the midpoint is easier since it lets the Bullet code manipulate the transforms
220 * of the objects.
221 * Code left for future programmers.
222 // ==================================================================================
223 // relative position normalized to the root prim
224 OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation);
225 OMV.Vector3 childRelativePosition = (childPrim.Position - rootPrim.Position) * invThisOrientation;
226
227 // relative rotation of the child to the parent
228 OMV.Quaternion childRelativeRotation = invThisOrientation * childPrim.Orientation;
229 OMV.Quaternion inverseChildRelativeRotation = OMV.Quaternion.Inverse(childRelativeRotation);
230
231 DetailLog("{0},BSLinksetConstraint.PhysicallyLinkAChildToRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
232 BS6DofConstraint constrain = new BS6DofConstraint(
233 PhysicsScene.World, rootPrim.Body, childPrim.Body,
234 OMV.Vector3.Zero,
235 OMV.Quaternion.Inverse(rootPrim.Orientation),
236 OMV.Vector3.Zero,
237 OMV.Quaternion.Inverse(childPrim.Orientation),
238 true,
239 true
240 );
241 // ==================================================================================
242 */
243 271
244 m_physicsScene.Constraints.AddConstraint(constrain); 272 BSConstraint constrain = null;
245 273
246 // zero linear and angular limits makes the objects unable to move in relation to each other 274 switch (liConstraint.constraintType)
247 constrain.SetLinearLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
248 constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
249
250 // tweek the constraint to increase stability
251 constrain.UseFrameOffset(BSParam.LinkConstraintUseFrameOffset);
252 constrain.TranslationalLimitMotor(BSParam.LinkConstraintEnableTransMotor,
253 BSParam.LinkConstraintTransMotorMaxVel,
254 BSParam.LinkConstraintTransMotorMaxForce);
255 constrain.SetCFMAndERP(BSParam.LinkConstraintCFM, BSParam.LinkConstraintERP);
256 if (BSParam.LinkConstraintSolverIterations != 0f)
257 { 275 {
258 constrain.SetSolverIterations(BSParam.LinkConstraintSolverIterations); 276 case ConstraintType.D6_CONSTRAINT_TYPE:
277 // Relative position normalized to the root prim
278 // Essentually a vector pointing from center of rootPrim to center of li.member
279 OMV.Vector3 childRelativePosition = liConstraint.member.Position - rootPrim.Position;
280
281 // real world coordinate of midpoint between the two objects
282 OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2);
283
284 DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}",
285 rootPrim.LocalID,
286 rootPrim.LocalID, rootPrim.PhysBody.AddrString,
287 liConstraint.member.LocalID, liConstraint.member.PhysBody.AddrString,
288 rootPrim.Position, liConstraint.member.Position, midPoint);
289
290 // create a constraint that allows no freedom of movement between the two objects
291 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
292
293 constrain = new BSConstraint6Dof(
294 m_physicsScene.World, rootPrim.PhysBody, liConstraint.member.PhysBody, midPoint, true, true );
295
296 /* NOTE: below is an attempt to build constraint with full frame computation, etc.
297 * Using the midpoint is easier since it lets the Bullet code manipulate the transforms
298 * of the objects.
299 * Code left for future programmers.
300 // ==================================================================================
301 // relative position normalized to the root prim
302 OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation);
303 OMV.Vector3 childRelativePosition = (liConstraint.member.Position - rootPrim.Position) * invThisOrientation;
304
305 // relative rotation of the child to the parent
306 OMV.Quaternion childRelativeRotation = invThisOrientation * liConstraint.member.Orientation;
307 OMV.Quaternion inverseChildRelativeRotation = OMV.Quaternion.Inverse(childRelativeRotation);
308
309 DetailLog("{0},BSLinksetConstraint.PhysicallyLinkAChildToRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, liConstraint.member.LocalID);
310 constrain = new BS6DofConstraint(
311 PhysicsScene.World, rootPrim.Body, liConstraint.member.Body,
312 OMV.Vector3.Zero,
313 OMV.Quaternion.Inverse(rootPrim.Orientation),
314 OMV.Vector3.Zero,
315 OMV.Quaternion.Inverse(liConstraint.member.Orientation),
316 true,
317 true
318 );
319 // ==================================================================================
320 */
321
322 break;
323 default:
324 break;
259 } 325 }
326
327 liConstraint.SetConstraintParameters(constrain);
328
329 m_physicsScene.Constraints.AddConstraint(constrain);
330
260 return constrain; 331 return constrain;
261 } 332 }
262 333
@@ -317,23 +388,24 @@ public sealed class BSLinksetConstraints : BSLinkset
317 return; // Note the 'finally' clause at the botton which will get executed. 388 return; // Note the 'finally' clause at the botton which will get executed.
318 } 389 }
319 390
320 foreach (BSPrimLinkable child in m_children) 391 ForEachLinkInfo((li) =>
321 { 392 {
322 // A child in the linkset physically shows the mass of the whole linkset. 393 // A child in the linkset physically shows the mass of the whole linkset.
323 // This allows Bullet to apply enough force on the child to move the whole linkset. 394 // This allows Bullet to apply enough force on the child to move the whole linkset.
324 // (Also do the mass stuff before recomputing the constraint so mass is not zero.) 395 // (Also do the mass stuff before recomputing the constraint so mass is not zero.)
325 child.UpdatePhysicalMassProperties(linksetMass, true); 396 li.member.UpdatePhysicalMassProperties(linksetMass, true);
326 397
327 BSConstraint constrain; 398 BSConstraint constrain;
328 if (!m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain)) 399 if (!m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, li.member.PhysBody, out constrain))
329 { 400 {
330 // If constraint doesn't exist yet, create it. 401 // If constraint doesn't exist yet, create it.
331 constrain = BuildConstraint(LinksetRoot, child); 402 constrain = BuildConstraint(LinksetRoot, li);
332 } 403 }
333 constrain.RecomputeConstraintVariables(linksetMass); 404 constrain.RecomputeConstraintVariables(linksetMass);
334 405
335 // PhysicsScene.PE.DumpConstraint(PhysicsScene.World, constrain.Constraint); // DEBUG DEBUG 406 // PhysicsScene.PE.DumpConstraint(PhysicsScene.World, constrain.Constraint); // DEBUG DEBUG
336 } 407 return false; // 'false' says to keep processing other members
408 });
337 } 409 }
338 finally 410 finally
339 { 411 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index e92a1d2..a0b6abc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1541,6 +1541,50 @@ public class BSPrim : BSPhysObject
1541 PhysicalActors.RemoveDependencies(); 1541 PhysicalActors.RemoveDependencies();
1542 } 1542 }
1543 1543
1544 #region Extension
1545 public override object Extension(string pFunct, params object[] pParams)
1546 {
1547 object ret = null;
1548 switch (pFunct)
1549 {
1550 case BSScene.PhysFunctGetLinksetType:
1551 {
1552 BSPrimLinkable myHandle = this as BSPrimLinkable;
1553 if (myHandle != null)
1554 {
1555 ret = (object)myHandle.LinksetType;
1556 }
1557 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
1558 break;
1559 }
1560 case BSScene.PhysFunctSetLinksetType:
1561 {
1562 if (pParams.Length > 0)
1563 {
1564 BSLinkset.LinksetImplementation linksetType = (BSLinkset.LinksetImplementation)pParams[0];
1565 BSPrimLinkable myHandle = this as BSPrimLinkable;
1566 if (myHandle != null && myHandle.Linkset.IsRoot(myHandle))
1567 {
1568 PhysScene.TaintedObject("BSPrim.PhysFunctSetLinksetType", delegate()
1569 {
1570 // Cause the linkset type to change
1571 m_log.DebugFormat("{0} Extension.physSetLinksetType, oldType={1}, newType={2}",
1572 LogHeader, myHandle.Linkset.LinksetImpl, linksetType);
1573 myHandle.ConvertLinkset(linksetType);
1574 });
1575 }
1576 ret = (object)(int)linksetType;
1577 }
1578 break;
1579 }
1580 default:
1581 ret = base.Extension(pFunct, pParams);
1582 break;
1583 }
1584 return ret;
1585 }
1586 #endregion // Extension
1587
1544 // The physics engine says that properties have updated. Update same and inform 1588 // The physics engine says that properties have updated. Update same and inform
1545 // the world that things have changed. 1589 // the world that things have changed.
1546 // NOTE: BSPrim.UpdateProperties is overloaded by BSPrimLinkable which modifies updates from root and children prims. 1590 // NOTE: BSPrim.UpdateProperties is overloaded by BSPrimLinkable which modifies updates from root and children prims.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index 2f392da..7179a6d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -233,5 +233,46 @@ public class BSPrimLinkable : BSPrimDisplaced
233 base.HasSomeCollision = value; 233 base.HasSomeCollision = value;
234 } 234 }
235 } 235 }
236
237 // Convert the existing linkset of this prim into a new type.
238 public bool ConvertLinkset(BSLinkset.LinksetImplementation newType)
239 {
240 bool ret = false;
241 if (LinksetType != newType)
242 {
243 // Set the implementation type first so the call to BSLinkset.Factory gets the new type.
244 this.LinksetType = newType;
245
246 BSLinkset oldLinkset = this.Linkset;
247 BSLinkset newLinkset = BSLinkset.Factory(PhysScene, this);
248
249 this.Linkset = newLinkset;
250
251 // Pick up any physical dependencies this linkset might have in the physics engine.
252 oldLinkset.RemoveDependencies(this);
253
254 // Create a list of the children (mainly because can't interate through a list that's changing)
255 List<BSPrimLinkable> children = new List<BSPrimLinkable>();
256 oldLinkset.ForEachMember((child) =>
257 {
258 if (!oldLinkset.IsRoot(child))
259 children.Add(child);
260 return false; // 'false' says to continue to next member
261 });
262
263 // Remove the children from the old linkset and add to the new (will be a new instance from the factory)
264 foreach (BSPrimLinkable child in children)
265 {
266 oldLinkset.RemoveMeFromLinkset(child);
267 newLinkset.AddMeToLinkset(child);
268 child.Linkset = newLinkset;
269 }
270
271 // Force the shape and linkset to get reconstructed
272 newLinkset.Refresh(this);
273 this.ForceBodyShapeRebuild(true /* inTaintTime */);
274 }
275 return ret;
276 }
236} 277}
237} 278}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 41aca3b..79ac5a5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -862,6 +862,23 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
862 862
863 public override bool IsThreaded { get { return false; } } 863 public override bool IsThreaded { get { return false; } }
864 864
865 #region Extensions
866 // =============================================================
867 // Per scene functions. See below.
868
869 // Per avatar functions. See BSCharacter.
870
871 // Per prim functions. See BSPrim.
872 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
873 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
874 // =============================================================
875
876 public override object Extension(string pFunct, params object[] pParams)
877 {
878 return base.Extension(pFunct, pParams);
879 }
880 #endregion // Extensions
881
865 #region Taints 882 #region Taints
866 // The simulation execution order is: 883 // The simulation execution order is:
867 // Simulate() 884 // Simulate()
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 739e984..44bfd42 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -418,7 +418,8 @@ namespace OpenSim.Region.Physics.Manager
418 // Extendable interface for new, physics engine specific operations 418 // Extendable interface for new, physics engine specific operations
419 public virtual object Extension(string pFunct, params object[] pParams) 419 public virtual object Extension(string pFunct, params object[] pParams)
420 { 420 {
421 throw new NotImplementedException(); 421 // A NOP of the physics engine does not implement this feature
422 return null;
422 } 423 }
423 } 424 }
424 425
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 52f2809..dd9bbc1 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -393,7 +393,8 @@ namespace OpenSim.Region.Physics.Manager
393 // Extendable interface for new, physics engine specific operations 393 // Extendable interface for new, physics engine specific operations
394 public virtual object Extension(string pFunct, params object[] pParams) 394 public virtual object Extension(string pFunct, params object[] pParams)
395 { 395 {
396 throw new NotImplementedException(); 396 // A NOP if the extension thing is not implemented by the physics engine
397 return null;
397 } 398 }
398 } 399 }
399} 400}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index bd776b6..edcdfbc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -319,7 +319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
319 319
320 object[] convertedParms = new object[parms.Length]; 320 object[] convertedParms = new object[parms.Length];
321 for (int i = 0; i < parms.Length; i++) 321 for (int i = 0; i < parms.Length; i++)
322 convertedParms[i] = ConvertFromLSL(parms[i],signature[i], fname); 322 convertedParms[i] = ConvertFromLSL(parms[i], signature[i], fname);
323 323
324 // now call the function, the contract with the function is that it will always return 324 // now call the function, the contract with the function is that it will always return
325 // non-null but don't trust it completely 325 // non-null but don't trust it completely
@@ -448,7 +448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
448 } 448 }
449 } 449 }
450 450
451 MODError(String.Format("{1}: parameter type mismatch; expecting {0}",type.Name, fname)); 451 MODError(String.Format("{0}: parameter type mismatch; expecting {1}, type(parm)={2}", fname, type.Name, lslparm.GetType()));
452 return null; 452 return null;
453 } 453 }
454 454
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index 9e32f40..6aa717d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -937,7 +937,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
937 { 937 {
938 string retval = null; 938 string retval = null;
939 if (value is int) 939 if (value is int)
940 retval = ((int)value).ToString(); 940 retval = String.Format("new LSL_Types.LSLInteger({0})",((int)value).ToString());
941 else if (value is float) 941 else if (value is float)
942 retval = String.Format("new LSL_Types.LSLFloat({0})",((float)value).ToString()); 942 retval = String.Format("new LSL_Types.LSLFloat({0})",((float)value).ToString());
943 else if (value is string) 943 else if (value is string)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
index 8226705..e85b0b7 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
@@ -79,7 +79,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
79 { 79 {
80 m_simianURL = m_config.GetString("SimianServiceURL"); 80 m_simianURL = m_config.GetString("SimianServiceURL");
81 if (String.IsNullOrEmpty(m_simianURL)) 81 if (String.IsNullOrEmpty(m_simianURL))
82 m_log.ErrorFormat("[SimianGrid] service URL is not defined"); 82 {
83 //m_log.DebugFormat("[SimianGrid] service URL is not defined");
84 m_enabled = false;
85 return;
86 }
83 } 87 }
84 } 88 }
85 else 89 else
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
index a4dd36c..e7d2f86 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
@@ -74,11 +74,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
74 { 74 {
75 m_simianURL = m_config.GetString("SimianServiceURL"); 75 m_simianURL = m_config.GetString("SimianServiceURL");
76 if (String.IsNullOrEmpty(m_simianURL)) 76 if (String.IsNullOrEmpty(m_simianURL))
77 m_log.ErrorFormat("[SimianGrid] service URL is not defined"); 77 {
78 // m_log.DebugFormat("[SimianGrid] service URL is not defined");
79 m_enabled = false;
80 return;
81 }
78 82
79 InitialiseSimCap(); 83 InitialiseSimCap();
80 SimulatorCapability = SimulatorCapability.Trim(); 84 SimulatorCapability = SimulatorCapability.Trim();
81 m_log.WarnFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability); 85 m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
82 } 86 }
83 } 87 }
84 catch (Exception e) 88 catch (Exception e)
diff --git a/OpenSim/Tests/Clients/Assets/AssetsClient.cs b/OpenSim/Tests/Clients/Assets/AssetsClient.cs
index 26d740b..e988d0e 100644
--- a/OpenSim/Tests/Clients/Assets/AssetsClient.cs
+++ b/OpenSim/Tests/Clients/Assets/AssetsClient.cs
@@ -68,8 +68,18 @@ namespace OpenSim.Tests.Clients.AssetsClient
68 m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} max threads = {1} - {2}", serverURI, max1, max2); 68 m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} max threads = {1} - {2}", serverURI, max1, max2);
69 ThreadPool.GetMinThreads(out max1, out max2); 69 ThreadPool.GetMinThreads(out max1, out max2);
70 m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} min threads = {1} - {2}", serverURI, max1, max2); 70 m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} min threads = {1} - {2}", serverURI, max1, max2);
71 ThreadPool.SetMinThreads(1, 1); 71
72 ThreadPool.SetMaxThreads(10, 3); 72 if (!ThreadPool.SetMinThreads(1, 1))
73 m_log.WarnFormat("[ASSET CLIENT]: Failed to set min threads");
74
75 if (!ThreadPool.SetMaxThreads(10, 3))
76 m_log.WarnFormat("[ASSET CLIENT]: Failed to set max threads");
77
78 ThreadPool.GetMaxThreads(out max1, out max2);
79 m_log.InfoFormat("[ASSET CLIENT]: Post set max threads = {1} - {2}", serverURI, max1, max2);
80 ThreadPool.GetMinThreads(out max1, out max2);
81 m_log.InfoFormat("[ASSET CLIENT]: Post set min threads = {1} - {2}", serverURI, max1, max2);
82
73 ServicePointManager.DefaultConnectionLimit = 12; 83 ServicePointManager.DefaultConnectionLimit = 12;
74 84
75 AssetServicesConnector m_Connector = new AssetServicesConnector(serverURI); 85 AssetServicesConnector m_Connector = new AssetServicesConnector(serverURI);
diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs
index 28bcc99..72ba185 100644
--- a/OpenSim/Tools/Configger/ConfigurationLoader.cs
+++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs
@@ -239,7 +239,6 @@ namespace OpenSim.Tools.Configger
239 config.Set("physics", "OpenDynamicsEngine"); 239 config.Set("physics", "OpenDynamicsEngine");
240 config.Set("meshing", "Meshmerizer"); 240 config.Set("meshing", "Meshmerizer");
241 config.Set("physical_prim", true); 241 config.Set("physical_prim", true);
242 config.Set("see_into_this_sim_from_neighbor", true);
243 config.Set("serverside_object_permissions", true); 242 config.Set("serverside_object_permissions", true);
244 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll"); 243 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
245 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3"); 244 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");