Compare commits
141 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5eb2526e88 | ||
|
|
641b08aa78 | ||
|
|
15d5f3d09d | ||
|
|
07dbe46ba3 | ||
|
|
ff867b59cf | ||
|
|
d4b8a13a1d | ||
|
|
a858c5daee | ||
|
|
8d431c6359 | ||
|
|
663bfbb372 | ||
|
|
d297eb39e5 | ||
|
|
29218cdb31 | ||
|
|
359f9efc76 | ||
|
|
fb211c64fd | ||
|
|
a3d140b57c | ||
|
|
f7b88d1c40 | ||
|
|
32b534f324 | ||
|
|
ffdc798720 | ||
|
|
ae852bb873 | ||
|
|
d3adf9b2b3 | ||
|
|
7c140570db | ||
|
|
7b6987ce83 | ||
|
|
0376b8ddbc | ||
|
|
2d2495cc45 | ||
|
|
a0eda6eb16 | ||
|
|
dac31303b7 | ||
|
|
edd3577b66 | ||
|
|
054db94d5d | ||
|
|
794c5f5a6d | ||
|
|
b625579780 | ||
|
|
7e41559917 | ||
|
|
8cd415c2b0 | ||
|
|
4c58c1b116 | ||
|
|
e6f43023b6 | ||
|
|
bcf944db48 | ||
|
|
7a9eee8538 | ||
|
|
05648c2c4a | ||
|
|
dff746df7b | ||
|
|
973f2e8be5 | ||
|
|
3c019bea8c | ||
|
|
68814f904e | ||
|
|
3bd3f448a2 | ||
|
|
7c6e8fab15 | ||
|
|
3ed0d79b00 | ||
|
|
d89b974680 | ||
|
|
c76c63725b | ||
|
|
6b277394c0 | ||
|
|
adce58b33a | ||
|
|
1f88179a65 | ||
|
|
ec726413dd | ||
|
|
3d736d575f | ||
|
|
0c3061f973 | ||
|
|
3bf7bd6359 | ||
|
|
7ea832d47c | ||
|
|
c1cece4b82 | ||
|
|
aa44df9c04 | ||
|
|
1e18f0f26a | ||
|
|
8a7fbfb06a | ||
|
|
e916b1399f | ||
|
|
72c2d13ac6 | ||
|
|
a6d689c529 | ||
|
|
ab9bfe5156 | ||
|
|
4e26d039d6 | ||
|
|
3082fdd0f6 | ||
|
|
e90168c738 | ||
|
|
a5c6cb2fc9 | ||
|
|
6ea95a3294 | ||
|
|
6e86b23012 | ||
|
|
58714b0aca | ||
|
|
5203665bb2 | ||
|
|
2a2e120470 | ||
|
|
a8044999fb | ||
|
|
3d504261b0 | ||
|
|
a0d178b284 | ||
|
|
f8a89a79eb | ||
|
|
e04047152f | ||
|
|
f3a5e3a02b | ||
|
|
ba58331b29 | ||
|
|
476996bee8 | ||
|
|
01771aca40 | ||
|
|
cd325fdf02 | ||
|
|
67477290ad | ||
|
|
582a256646 | ||
|
|
d188272462 | ||
|
|
632908db9e | ||
|
|
82b23f7cc1 | ||
|
|
a08687aef3 | ||
|
|
2ad9d656b3 | ||
|
|
1747030d19 | ||
|
|
c557684666 | ||
|
|
a3cbda0d74 | ||
|
|
4f3fabae5b | ||
|
|
aede42b875 | ||
|
|
a533db7e27 | ||
|
|
4820dfd733 | ||
|
|
1369058280 | ||
|
|
568de9313a | ||
|
|
219326dd8e | ||
|
|
9925317239 | ||
|
|
150748392e | ||
|
|
555edc4ef7 | ||
|
|
481c00f50a | ||
|
|
ede3b9ab07 | ||
|
|
b863a15a82 | ||
|
|
aee4353e9c | ||
|
|
e6fb458597 | ||
|
|
812c498ef4 | ||
|
|
970727e57e | ||
|
|
bcbd450fe4 | ||
|
|
9aec62f0ac | ||
|
|
dd0556abc9 | ||
|
|
8769e4ee73 | ||
|
|
d72d599056 | ||
|
|
ca33619e11 | ||
|
|
ffdde05bb7 | ||
|
|
fb84ff96a9 | ||
|
|
52d7af05bc | ||
|
|
2b0c8bc480 | ||
|
|
2a70afeca2 | ||
|
|
5d7751da89 | ||
|
|
9d6fe1224a | ||
|
|
e4e5237086 | ||
|
|
28d0aff2e3 | ||
|
|
7068fddd2f | ||
|
|
466d684fbe | ||
|
|
74f5253a36 | ||
|
|
3ad827174e | ||
|
|
56da788243 | ||
|
|
7243d4f842 | ||
|
|
f57c1ac386 | ||
|
|
0860a0d856 | ||
|
|
03d76e9403 | ||
|
|
5c192b9bab | ||
|
|
ccc69d66a1 | ||
|
|
8eda290262 | ||
|
|
e31e23d68d | ||
|
|
99e339dd40 | ||
|
|
e9ea911563 | ||
|
|
57a9879669 | ||
|
|
376441e550 | ||
|
|
ae5db637f2 | ||
|
|
ef4122213c |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
.project
|
||||
.settings
|
||||
.gitignore
|
||||
*.csproj
|
||||
*.csproj.user
|
||||
*.build
|
||||
@@ -11,7 +10,6 @@
|
||||
*.pidb
|
||||
*.dll.build
|
||||
*.dll
|
||||
*.log
|
||||
*.VisualState.xml
|
||||
*/*/obj
|
||||
*/*/*/obj
|
||||
@@ -25,13 +23,17 @@
|
||||
*/*/*/*/*/bin
|
||||
*/*/*/*/*/*/bin
|
||||
*/*/*/*/*/*/*/bin
|
||||
addon-modules/
|
||||
bin/Debug/*.dll
|
||||
bin/*.dll.mdb
|
||||
bin/*.db
|
||||
bin/*.db-journal
|
||||
bin/addin-db-*
|
||||
bin/*.dll
|
||||
bin/OpenSim.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.log
|
||||
UpgradeLog.XML
|
||||
_UpgradeReport_Files/
|
||||
bin/ScriptEngines/*-*-*-*-*
|
||||
bin/ScriptEngines/*.dll
|
||||
bin/ScriptEngines/*/*.dll
|
||||
|
||||
@@ -135,14 +135,25 @@
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="torture" depends="build, find-nunit">
|
||||
<target name="test-stress" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.torture">
|
||||
<arg value="./bin/OpenSim.Tests.Torture.dll" />
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
|
||||
<arg value="./bin/OpenSim.Tests.Stress.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
|
||||
<fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="test-perf" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.performance">
|
||||
<arg value="./bin/OpenSim.Tests.Performance.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in performance tests." unless="${int::parse(testresult.opensim.tests.performance)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<<<>>>>The following people have contributed to OpenSim (Thank you
|
||||
<<<>>>>The following people have contributed to OpenSim (Thank you
|
||||
for your effort!)
|
||||
|
||||
= Current OpenSim Developers (in very rough order of appearance) =
|
||||
@@ -92,6 +92,7 @@ what it is today.
|
||||
* Flyte Xevious
|
||||
* Garmin Kawaguichi
|
||||
* Gryc Ueusp
|
||||
* Hiro Lecker
|
||||
* Imaze Rhiano
|
||||
* Intimidated
|
||||
* Jeremy Bongio (IBM)
|
||||
|
||||
@@ -131,7 +131,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod);
|
||||
availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod);
|
||||
availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod);
|
||||
availableMethods["admin_dialog"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcDialogMethod);
|
||||
availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod);
|
||||
availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod);
|
||||
availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod);
|
||||
@@ -258,101 +257,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
{
|
||||
m_log.Info("[RADMIN]: Request to restart Region.");
|
||||
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene rebootedScene = null;
|
||||
bool restartAll = false;
|
||||
|
||||
IConfig startupConfig = m_configSource.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
if (startupConfig.GetBoolean("InworldRestartShutsDown", false))
|
||||
{
|
||||
rebootedScene = m_application.SceneManager.CurrentOrFirstScene;
|
||||
restartAll = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (rebootedScene == null)
|
||||
{
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
|
||||
}
|
||||
|
||||
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
||||
GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["accepted"] = true;
|
||||
responseData["rebooting"] = true;
|
||||
|
||||
string message;
|
||||
List<int> times = new List<int>();
|
||||
|
||||
if (requestData.ContainsKey("alerts"))
|
||||
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
||||
if (restartModule != null)
|
||||
{
|
||||
string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','});
|
||||
if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1)
|
||||
{
|
||||
if (restartModule != null)
|
||||
{
|
||||
message = "Restart has been cancelled";
|
||||
List<int> times = new List<int> { 30, 15 };
|
||||
|
||||
if (requestData.ContainsKey("message"))
|
||||
message = requestData["message"].ToString();
|
||||
|
||||
restartModule.AbortRestart(message);
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["rebooting"] = false;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach (string a in alertTimes)
|
||||
times.Add(Convert.ToInt32(a));
|
||||
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
|
||||
responseData["success"] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int timeout = 30;
|
||||
if (requestData.ContainsKey("milliseconds"))
|
||||
timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000;
|
||||
while (timeout > 0)
|
||||
{
|
||||
times.Add(timeout);
|
||||
if (timeout > 300)
|
||||
timeout -= 120;
|
||||
else if (timeout > 30)
|
||||
timeout -= 30;
|
||||
else
|
||||
timeout -= 15;
|
||||
}
|
||||
}
|
||||
|
||||
message = "Region is restarting in {0}. Please save what you are doing and log out.";
|
||||
|
||||
if (requestData.ContainsKey("message"))
|
||||
message = requestData["message"].ToString();
|
||||
|
||||
bool notice = true;
|
||||
if (requestData.ContainsKey("noticetype")
|
||||
&& ((string)requestData["noticetype"] == "dialog"))
|
||||
{
|
||||
notice = false;
|
||||
}
|
||||
|
||||
List<Scene> restartList;
|
||||
|
||||
if (restartAll)
|
||||
restartList = m_application.SceneManager.Scenes;
|
||||
else
|
||||
restartList = new List<Scene>() { rebootedScene };
|
||||
|
||||
foreach (Scene s in m_application.SceneManager.Scenes)
|
||||
{
|
||||
restartModule = s.RequestModuleInterface<IRestartModule>();
|
||||
if (restartModule != null)
|
||||
restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice);
|
||||
}
|
||||
responseData["success"] = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -389,32 +310,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
m_log.Info("[RADMIN]: Alert request complete");
|
||||
}
|
||||
|
||||
public void XmlRpcDialogMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
m_log.Info("[RADMIN]: Dialog request started");
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
string message = (string)requestData["message"];
|
||||
string fromuuid = (string)requestData["from"];
|
||||
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
|
||||
|
||||
responseData["accepted"] = true;
|
||||
responseData["success"] = true;
|
||||
|
||||
m_application.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
|
||||
});
|
||||
|
||||
m_log.Info("[RADMIN]: Dialog request complete");
|
||||
}
|
||||
|
||||
private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Info("[RADMIN]: Load height maps request started");
|
||||
@@ -503,32 +398,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
message = "Region is going down now.";
|
||||
}
|
||||
|
||||
if (requestData.ContainsKey("noticetype")
|
||||
&& ((string) requestData["noticetype"] == "dialog"))
|
||||
{
|
||||
m_application.SceneManager.ForEachScene(
|
||||
|
||||
m_application.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!requestData.ContainsKey("noticetype")
|
||||
|| ((string)requestData["noticetype"] != "none"))
|
||||
{
|
||||
m_application.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendGeneralAlert(message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Perform shutdown
|
||||
System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
|
||||
@@ -1694,31 +1570,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
|
||||
private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Info("[RADMIN]: Received Query XML Administrator Request");
|
||||
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
int flags = 0;
|
||||
string text = String.Empty;
|
||||
int health = 0;
|
||||
responseData["success"] = true;
|
||||
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
try
|
||||
{
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
health = scene.GetHealth(out flags, out text);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
responseData["error"] = null;
|
||||
}
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
int health = scene.GetHealth();
|
||||
responseData["health"] = health;
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["health"] = health;
|
||||
responseData["flags"] = flags;
|
||||
responseData["message"] = text;
|
||||
m_log.Info("[RADMIN]: Query XML Administrator Request complete");
|
||||
}
|
||||
|
||||
private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||
|
||||
@@ -224,9 +224,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// sending back the last byte instead of an error status
|
||||
if (start >= texture.Data.Length)
|
||||
{
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
// viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenSim.Data
|
||||
{
|
||||
public abstract AssetBase GetAsset(UUID uuid);
|
||||
|
||||
public abstract bool StoreAsset(AssetBase asset);
|
||||
public abstract void StoreAsset(AssetBase asset);
|
||||
public abstract bool ExistsAsset(UUID uuid);
|
||||
|
||||
public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenSim.Data
|
||||
public interface IAssetDataPlugin : IPlugin
|
||||
{
|
||||
AssetBase GetAsset(UUID uuid);
|
||||
bool StoreAsset(AssetBase asset);
|
||||
void StoreAsset(AssetBase asset);
|
||||
bool ExistsAsset(UUID uuid);
|
||||
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
void Initialise(string connect);
|
||||
|
||||
@@ -50,6 +50,5 @@ namespace OpenSim.Data
|
||||
bool Store(UserAccountData data);
|
||||
bool Delete(string field, string val);
|
||||
UserAccountData[] GetUsers(UUID scopeID, string query);
|
||||
UserAccountData[] GetUsersWhere(UUID scopeID, string where);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace OpenSim.Data
|
||||
public UUID folderID;
|
||||
public UUID agentID;
|
||||
public UUID parentFolderID;
|
||||
|
||||
public XInventoryFolder Clone()
|
||||
{
|
||||
return (XInventoryFolder)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public class XInventoryItem
|
||||
@@ -64,6 +69,11 @@ namespace OpenSim.Data
|
||||
public UUID avatarID;
|
||||
public UUID parentFolderID;
|
||||
public int inventoryGroupPermissions;
|
||||
|
||||
public XInventoryItem Clone()
|
||||
{
|
||||
return (XInventoryItem)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IXInventoryData
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace OpenSim.Data.MSSQL
|
||||
/// Create asset in m_database
|
||||
/// </summary>
|
||||
/// <param name="asset">the asset</param>
|
||||
override public bool StoreAsset(AssetBase asset)
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
|
||||
string sql =
|
||||
@@ -192,12 +192,10 @@ namespace OpenSim.Data.MSSQL
|
||||
try
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
m_log.Error("[ASSET DB]: Error storing item :" + e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||
public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>,
|
||||
IAvatarData
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MSSQLAvatarData(string connectionString, string realm) :
|
||||
base(connectionString, realm, "Avatar")
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLGenericTableHandler<T> where T : class, new()
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected string m_ConnectionString;
|
||||
protected MSSQLManager m_database; //used for parameter type translation
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||
public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>,
|
||||
IGridUserData
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MSSQLGridUserData(string connectionString, string realm) :
|
||||
base(connectionString, realm, "GridUserStore")
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </summary>
|
||||
public class MSSQLManager
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Connection string for ADO.net
|
||||
@@ -185,8 +185,6 @@ namespace OpenSim.Data.MSSQL
|
||||
return parameter;
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if we need to do some migrations to the database
|
||||
/// </summary>
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||
public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>,
|
||||
IPresenceData
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MSSQLPresenceData(string connectionString, string realm) :
|
||||
base(connectionString, realm, "Presence")
|
||||
|
||||
@@ -2203,11 +2203,6 @@ VALUES
|
||||
}
|
||||
}
|
||||
|
||||
public UUID[] GetObjectIDs(UUID regionID)
|
||||
{
|
||||
return new UUID[0];
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string value)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -242,10 +242,5 @@ namespace OpenSim.Data.MSSQL
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLXInventoryData : IXInventoryData
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private MSSQLGenericTableHandler<XInventoryFolder> m_Folders;
|
||||
private MSSQLItemHandler m_Items;
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace OpenSim.Data.MySQL
|
||||
/// </summary>
|
||||
/// <param name="asset">Asset UUID to create</param>
|
||||
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
||||
override public bool StoreAsset(AssetBase asset)
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
@@ -201,14 +201,12 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -372,4 +370,4 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,11 +175,6 @@ namespace OpenSim.Data.MySQL
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v);
|
||||
}
|
||||
else if (m_Fields[name].FieldType == typeof(uint))
|
||||
{
|
||||
uint v = Convert.ToUInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Fields[name].SetValue(row, reader[name]);
|
||||
@@ -301,4 +296,4 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
public virtual void Initialise(string connectionString)
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
@@ -113,16 +113,14 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void Dispose() {}
|
||||
|
||||
public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
||||
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
||||
{
|
||||
uint flags = obj.RootPart.GetEffectiveObjectFlags();
|
||||
|
||||
// Eligibility check
|
||||
//
|
||||
// PrimFlags.Temporary is not used in OpenSim code and cannot
|
||||
// be guaranteed to always be clear. Don't check it.
|
||||
// if ((flags & (uint)PrimFlags.Temporary) != 0)
|
||||
// return;
|
||||
if ((flags & (uint)PrimFlags.Temporary) != 0)
|
||||
return;
|
||||
if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
|
||||
return;
|
||||
|
||||
@@ -137,7 +135,7 @@ namespace OpenSim.Data.MySQL
|
||||
foreach (SceneObjectPart prim in obj.Parts)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
|
||||
cmd.CommandText = "replace into prims (" +
|
||||
"UUID, CreationDate, " +
|
||||
"Name, Text, Description, " +
|
||||
@@ -173,11 +171,7 @@ namespace OpenSim.Data.MySQL
|
||||
"ParticleSystem, ClickAction, Material, " +
|
||||
"CollisionSound, CollisionSoundVolume, " +
|
||||
"PassTouches, " +
|
||||
"PassCollisions, " +
|
||||
"LinkNumber, MediaURL, KeyframeMotion, " +
|
||||
"PhysicsShapeType, Density, GravityModifier, " +
|
||||
"Friction, Restitution, Vehicle " +
|
||||
") values (" + "?UUID, " +
|
||||
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
||||
"?CreationDate, ?Name, ?Text, " +
|
||||
"?Description, ?SitName, ?TouchName, " +
|
||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||
@@ -208,17 +202,14 @@ namespace OpenSim.Data.MySQL
|
||||
"?SaleType, ?ColorR, ?ColorG, " +
|
||||
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
||||
"?ClickAction, ?Material, ?CollisionSound, " +
|
||||
"?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
|
||||
"?LinkNumber, ?MediaURL, ?KeyframeMotion, " +
|
||||
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
|
||||
"?Friction, ?Restitution, ?Vehicle)";
|
||||
|
||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
|
||||
cmd.CommandText = "replace into primshapes (" +
|
||||
"UUID, Shape, ScaleX, ScaleY, " +
|
||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||
@@ -240,9 +231,9 @@ namespace OpenSim.Data.MySQL
|
||||
"?ProfileEnd, ?ProfileCurve, " +
|
||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||
"?State, ?Media)";
|
||||
|
||||
|
||||
FillShapeCommand(cmd, prim);
|
||||
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
@@ -250,7 +241,7 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveObject(UUID obj, UUID regionUUID)
|
||||
public void RemoveObject(UUID obj, UUID regionUUID)
|
||||
{
|
||||
// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
|
||||
|
||||
@@ -399,7 +390,7 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
|
||||
public List<SceneObjectGroup> LoadObjects(UUID regionID)
|
||||
{
|
||||
const int ROWS_PER_QUERY = 5000;
|
||||
|
||||
@@ -455,11 +446,7 @@ namespace OpenSim.Data.MySQL
|
||||
foreach (SceneObjectPart prim in prims.Values)
|
||||
{
|
||||
if (prim.ParentUUID == UUID.Zero)
|
||||
{
|
||||
objects[prim.UUID] = new SceneObjectGroup(prim);
|
||||
if (prim.KeyframeMotion != null)
|
||||
prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add all of the children objects to the SOGs
|
||||
@@ -572,51 +559,36 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void StoreTerrain(double[,] ter, UUID regionID)
|
||||
public void StoreTerrain(double[,] ter, UUID regionID)
|
||||
{
|
||||
Util.FireAndForget(delegate(object x)
|
||||
m_log.Info("[REGION DB]: Storing terrain");
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
double[,] oldTerrain = LoadTerrain(regionID);
|
||||
|
||||
m_log.Info("[REGION DB]: Storing terrain");
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
|
||||
cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
|
||||
cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
using (MySqlCommand cmd2 = dbcon.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd2.CommandText = "insert into terrain (RegionUUID, " +
|
||||
"Revision, Heightfield) values (?RegionUUID, " +
|
||||
"1, ?Heightfield)";
|
||||
cmd.CommandText = "insert into terrain (RegionUUID, " +
|
||||
"Revision, Heightfield) values (?RegionUUID, " +
|
||||
"1, ?Heightfield)";
|
||||
|
||||
cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||
cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain));
|
||||
cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter));
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
ExecuteNonQuery(cmd2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double[,] LoadTerrain(UUID regionID)
|
||||
public double[,] LoadTerrain(UUID regionID)
|
||||
{
|
||||
double[,] terrain = null;
|
||||
|
||||
@@ -666,7 +638,7 @@ namespace OpenSim.Data.MySQL
|
||||
return terrain;
|
||||
}
|
||||
|
||||
public virtual void RemoveLandObject(UUID globalID)
|
||||
public void RemoveLandObject(UUID globalID)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
@@ -685,7 +657,7 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void StoreLandObject(ILandObject parcel)
|
||||
public void StoreLandObject(ILandObject parcel)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
@@ -742,104 +714,108 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
// StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
nWP.valid = true;
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
nWP.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nWP;
|
||||
}
|
||||
|
||||
public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
public RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
RegionSettings rs = null;
|
||||
|
||||
@@ -879,120 +855,126 @@ namespace OpenSim.Data.MySQL
|
||||
return rs;
|
||||
}
|
||||
|
||||
public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveRegionWindlightSettings(UUID regionID)
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1000,26 +982,29 @@ namespace OpenSim.Data.MySQL
|
||||
#region RegionEnvironmentSettings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1027,39 +1012,45 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public virtual void StoreRegionSettings(RegionSettings rs)
|
||||
public void StoreRegionSettings(RegionSettings rs)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
@@ -1086,7 +1077,7 @@ namespace OpenSim.Data.MySQL
|
||||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, block_search, casino, " +
|
||||
"loaded_creation_id, map_tile_ID, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
@@ -1103,8 +1094,7 @@ namespace OpenSim.Data.MySQL
|
||||
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, ?block_search, ?casino, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
"?TerrainImageID, ?TelehubObject, ?ParcelImageID) ";
|
||||
|
||||
FillRegionSettingsCommand(cmd, rs);
|
||||
|
||||
@@ -1115,7 +1105,7 @@ namespace OpenSim.Data.MySQL
|
||||
SaveSpawnPoints(rs);
|
||||
}
|
||||
|
||||
public virtual List<LandData> LoadLandObjects(UUID regionUUID)
|
||||
public List<LandData> LoadLandObjects(UUID regionUUID)
|
||||
{
|
||||
List<LandData> landData = new List<LandData>();
|
||||
|
||||
@@ -1297,40 +1287,11 @@ namespace OpenSim.Data.MySQL
|
||||
prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
|
||||
|
||||
prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
|
||||
prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
|
||||
prim.LinkNum = (int)row["LinkNumber"];
|
||||
|
||||
if (!(row["MediaURL"] is System.DBNull))
|
||||
prim.MediaUrl = (string)row["MediaURL"];
|
||||
|
||||
if (!(row["KeyframeMotion"] is DBNull))
|
||||
{
|
||||
Byte[] data = (byte[])row["KeyframeMotion"];
|
||||
if (data.Length > 0)
|
||||
prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
|
||||
else
|
||||
prim.KeyframeMotion = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
prim.KeyframeMotion = null;
|
||||
}
|
||||
|
||||
prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
|
||||
prim.Density = (float)(double)row["Density"];
|
||||
prim.GravityModifier = (float)(double)row["GravityModifier"];
|
||||
prim.Friction = (float)(double)row["Friction"];
|
||||
prim.Bounciness = (float)(double)row["Restitution"];
|
||||
|
||||
SOPVehicle vehicle = null;
|
||||
|
||||
if (row["Vehicle"].ToString() != String.Empty)
|
||||
{
|
||||
vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
|
||||
if (vehicle != null)
|
||||
prim.VehicleParams = vehicle;
|
||||
}
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
||||
@@ -1341,40 +1302,32 @@ namespace OpenSim.Data.MySQL
|
||||
/// <returns></returns>
|
||||
private static TaskInventoryItem BuildItem(IDataReader row)
|
||||
{
|
||||
try
|
||||
{
|
||||
TaskInventoryItem taskItem = new TaskInventoryItem();
|
||||
TaskInventoryItem taskItem = new TaskInventoryItem();
|
||||
|
||||
taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
|
||||
taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
|
||||
taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
|
||||
taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
|
||||
taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
|
||||
taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
|
||||
taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
|
||||
taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
|
||||
|
||||
taskItem.InvType = Convert.ToInt32(row["invType"]);
|
||||
taskItem.Type = Convert.ToInt32(row["assetType"]);
|
||||
taskItem.InvType = Convert.ToInt32(row["invType"]);
|
||||
taskItem.Type = Convert.ToInt32(row["assetType"]);
|
||||
|
||||
taskItem.Name = (String)row["name"];
|
||||
taskItem.Description = (String)row["description"];
|
||||
taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
|
||||
taskItem.CreatorIdentification = (String)row["creatorID"];
|
||||
taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
|
||||
taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
|
||||
taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
|
||||
taskItem.Name = (String)row["name"];
|
||||
taskItem.Description = (String)row["description"];
|
||||
taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
|
||||
taskItem.CreatorIdentification = (String)row["creatorID"];
|
||||
taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
|
||||
taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
|
||||
taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
|
||||
|
||||
taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
|
||||
taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
|
||||
taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
|
||||
taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
|
||||
taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
|
||||
taskItem.Flags = Convert.ToUInt32(row["flags"]);
|
||||
taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
|
||||
taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
|
||||
taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
|
||||
taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
|
||||
taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
|
||||
taskItem.Flags = Convert.ToUInt32(row["flags"]);
|
||||
|
||||
return taskItem;
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString());
|
||||
throw;
|
||||
}
|
||||
return taskItem;
|
||||
}
|
||||
|
||||
private static RegionSettings BuildRegionSettings(IDataReader row)
|
||||
@@ -1432,9 +1385,6 @@ namespace OpenSim.Data.MySQL
|
||||
newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
|
||||
newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
|
||||
|
||||
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
|
||||
newSettings.Casino = Convert.ToBoolean(row["casino"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
@@ -1532,7 +1482,7 @@ namespace OpenSim.Data.MySQL
|
||||
/// </summary>
|
||||
/// <param name="val"></param>
|
||||
/// <returns></returns>
|
||||
private static Array SerializeTerrain(double[,] val, double[,] oldTerrain)
|
||||
private static Array SerializeTerrain(double[,] val)
|
||||
{
|
||||
MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
|
||||
BinaryWriter bw = new BinaryWriter(str);
|
||||
@@ -1541,11 +1491,7 @@ namespace OpenSim.Data.MySQL
|
||||
for (int x = 0; x < (int)Constants.RegionSize; x++)
|
||||
for (int y = 0; y < (int)Constants.RegionSize; y++)
|
||||
{
|
||||
double height = 20.0;
|
||||
if (oldTerrain != null)
|
||||
height = oldTerrain[x, y];
|
||||
if (!double.IsNaN(val[x, y]))
|
||||
height = val[x, y];
|
||||
double height = val[x, y];
|
||||
if (height == 0.0)
|
||||
height = double.Epsilon;
|
||||
|
||||
@@ -1689,29 +1635,8 @@ namespace OpenSim.Data.MySQL
|
||||
else
|
||||
cmd.Parameters.AddWithValue("PassTouches", 0);
|
||||
|
||||
if (prim.PassCollisions)
|
||||
cmd.Parameters.AddWithValue("PassCollisions", 1);
|
||||
else
|
||||
cmd.Parameters.AddWithValue("PassCollisions", 0);
|
||||
|
||||
cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
|
||||
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
|
||||
|
||||
if (prim.KeyframeMotion != null)
|
||||
cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
|
||||
else
|
||||
cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
|
||||
|
||||
cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
|
||||
cmd.Parameters.AddWithValue("Density", (double)prim.Density);
|
||||
cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
|
||||
cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
|
||||
cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness);
|
||||
|
||||
if (prim.VehicleParams != null)
|
||||
cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
|
||||
else
|
||||
cmd.Parameters.AddWithValue("Vehicle", String.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1790,9 +1715,6 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
|
||||
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
|
||||
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
|
||||
cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
|
||||
cmd.Parameters.AddWithValue("casino", settings.Casino);
|
||||
|
||||
cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
|
||||
cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
|
||||
}
|
||||
@@ -1953,7 +1875,7 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
|
||||
}
|
||||
|
||||
public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
@@ -1997,37 +1919,6 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public UUID[] GetObjectIDs(UUID regionID)
|
||||
{
|
||||
List<UUID> uuids = new List<UUID>();
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID";
|
||||
cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||
|
||||
using (IDataReader reader = ExecuteReader(cmd))
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
UUID id = new UUID(reader["UUID"].ToString());
|
||||
|
||||
uuids.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uuids.ToArray();
|
||||
}
|
||||
|
||||
private void LoadSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
rs.ClearSpawnPoints();
|
||||
|
||||
@@ -46,21 +46,17 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
string[] words = query.Split(new char[] {' '});
|
||||
|
||||
bool valid = false;
|
||||
|
||||
for (int i = 0 ; i < words.Length ; i++)
|
||||
{
|
||||
if (words[i].Length > 2)
|
||||
valid = true;
|
||||
// if (words[i].Length < 3)
|
||||
// {
|
||||
// if (i != words.Length - 1)
|
||||
// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
||||
// Array.Resize(ref words, words.Length - 1);
|
||||
// }
|
||||
if (words[i].Length < 3)
|
||||
{
|
||||
if (i != words.Length - 1)
|
||||
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
||||
Array.Resize(ref words, words.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((!valid) || words.Length == 0)
|
||||
if (words.Length == 0)
|
||||
return new UserAccountData[0];
|
||||
|
||||
if (words.Length > 2)
|
||||
@@ -70,36 +66,20 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
if (words.Length == 1)
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?search", words[0] + "%");
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?searchLast", words[1] + "%");
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
if (scopeID != UUID.Zero)
|
||||
{
|
||||
where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
|
||||
cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -497,4 +497,4 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -717,7 +717,7 @@ ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 32 #---------------------
|
||||
:VERSION 32
|
||||
|
||||
BEGIN;
|
||||
CREATE TABLE `regionwindlight` (
|
||||
|
||||
@@ -152,11 +152,6 @@ namespace OpenSim.Data.Null
|
||||
{
|
||||
}
|
||||
|
||||
public UUID[] GetObjectIDs(UUID regionID)
|
||||
{
|
||||
return new UUID[0];
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string value)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -193,10 +193,5 @@ namespace OpenSim.Data.Null
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace OpenSim.Data.SQLite
|
||||
/// Create an asset
|
||||
/// </summary>
|
||||
/// <param name="asset">Asset Base</param>
|
||||
override public bool StoreAsset(AssetBase asset)
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
|
||||
if (ExistsAsset(asset.FullID))
|
||||
@@ -153,7 +153,6 @@ namespace OpenSim.Data.SQLite
|
||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +173,6 @@ namespace OpenSim.Data.SQLite
|
||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2890,11 +2890,6 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
}
|
||||
|
||||
public UUID[] GetObjectIDs(UUID regionID)
|
||||
{
|
||||
return new UUID[0];
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string value)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -81,10 +81,5 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
|
||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
private AssetMetadata m_metadata;
|
||||
|
||||
private int m_uploadAttempts;
|
||||
|
||||
// This is needed for .NET serialization!!!
|
||||
// Do NOT "Optimize" away!
|
||||
public AssetBase()
|
||||
@@ -200,12 +198,6 @@ namespace OpenSim.Framework
|
||||
set { m_metadata.Type = value; }
|
||||
}
|
||||
|
||||
public int UploadAttempts
|
||||
{
|
||||
get { return m_uploadAttempts; }
|
||||
set { m_uploadAttempts = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is this a region only asset, or does this exist on the asset server also
|
||||
/// </summary>
|
||||
|
||||
@@ -42,8 +42,6 @@ namespace OpenSim.Framework
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// this is viewer capabilities and weared things dependent
|
||||
// should be only used as initial default value ( V1 viewers )
|
||||
public readonly static int VISUALPARAM_COUNT = 218;
|
||||
|
||||
public readonly static int TEXTURE_COUNT = 21;
|
||||
@@ -242,21 +240,6 @@ namespace OpenSim.Framework
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invalidate all of the baked textures in the appearance, useful
|
||||
/// if you know that none are valid
|
||||
/// </summary>
|
||||
public virtual void ResetBakedTextures()
|
||||
{
|
||||
SetDefaultTexture();
|
||||
|
||||
//for (int i = 0; i < BAKE_INDICES.Length; i++)
|
||||
// {
|
||||
// int idx = BAKE_INDICES[i];
|
||||
// m_texture.FaceTextures[idx].TextureID = UUID.Zero;
|
||||
// }
|
||||
}
|
||||
|
||||
protected virtual void SetDefaultTexture()
|
||||
{
|
||||
m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
|
||||
@@ -321,30 +304,19 @@ namespace OpenSim.Framework
|
||||
// made. We determine if any of the visual parameters actually
|
||||
// changed to know if the appearance should be saved later
|
||||
bool changed = false;
|
||||
|
||||
int newsize = visualParams.Length;
|
||||
|
||||
if (newsize != m_visualparams.Length)
|
||||
for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++)
|
||||
{
|
||||
changed = true;
|
||||
m_visualparams = (byte[])visualParams.Clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int i = 0; i < newsize; i++)
|
||||
if (visualParams[i] != m_visualparams[i])
|
||||
{
|
||||
if (visualParams[i] != m_visualparams[i])
|
||||
{
|
||||
// DEBUG ON
|
||||
// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}",
|
||||
// i,m_visualparams[i],visualParams[i]);
|
||||
// DEBUG OFF
|
||||
m_visualparams[i] = visualParams[i];
|
||||
changed = true;
|
||||
}
|
||||
// DEBUG ON
|
||||
// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}",
|
||||
// i,m_visualparams[i],visualParams[i]);
|
||||
// DEBUG OFF
|
||||
m_visualparams[i] = visualParams[i];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the height if the visual parameters actually changed
|
||||
if (changed)
|
||||
SetHeight();
|
||||
@@ -402,8 +374,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
s += "Visual Params: ";
|
||||
// for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++)
|
||||
for (uint j = 0; j < m_visualparams.Length; j++)
|
||||
for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++)
|
||||
s += String.Format("{0},",m_visualparams[j]);
|
||||
s += "\n";
|
||||
|
||||
@@ -419,18 +390,19 @@ namespace OpenSim.Framework
|
||||
/// </remarks>
|
||||
public List<AvatarAttachment> GetAttachments()
|
||||
{
|
||||
|
||||
List<AvatarAttachment> alist = new List<AvatarAttachment>();
|
||||
|
||||
lock (m_attachments)
|
||||
{
|
||||
List<AvatarAttachment> alist = new List<AvatarAttachment>();
|
||||
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
|
||||
{
|
||||
foreach (AvatarAttachment attach in kvp.Value)
|
||||
alist.Add(new AvatarAttachment(attach));
|
||||
}
|
||||
return alist;
|
||||
} }
|
||||
}
|
||||
|
||||
return alist;
|
||||
}
|
||||
|
||||
internal void AppendAttachment(AvatarAttachment attach)
|
||||
{
|
||||
@@ -559,6 +531,7 @@ namespace OpenSim.Framework
|
||||
return kvp.Key;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -625,14 +598,12 @@ namespace OpenSim.Framework
|
||||
OSDBinary visualparams = new OSDBinary(m_visualparams);
|
||||
data["visualparams"] = visualparams;
|
||||
|
||||
lock (m_attachments)
|
||||
{
|
||||
// Attachments
|
||||
OSDArray attachs = new OSDArray(m_attachments.Count);
|
||||
foreach (AvatarAttachment attach in GetAttachments())
|
||||
attachs.Add(attach.Pack());
|
||||
data["attachments"] = attachs;
|
||||
}
|
||||
// Attachments
|
||||
List<AvatarAttachment> attachments = GetAttachments();
|
||||
OSDArray attachs = new OSDArray(attachments.Count);
|
||||
foreach (AvatarAttachment attach in GetAttachments())
|
||||
attachs.Add(attach.Pack());
|
||||
data["attachments"] = attachs;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -62,14 +62,9 @@ namespace OpenSim.Framework
|
||||
public static readonly int UNDERSHIRT = 10;
|
||||
public static readonly int UNDERPANTS = 11;
|
||||
public static readonly int SKIRT = 12;
|
||||
|
||||
public static readonly int MAX_BASICWEARABLES = 13;
|
||||
|
||||
public static readonly int ALPHA = 13;
|
||||
public static readonly int TATTOO = 14;
|
||||
// public static readonly int PHYSICS = 15;
|
||||
|
||||
// public static readonly int MAX_WEARABLES = 16;
|
||||
public static readonly int MAX_WEARABLES = 15;
|
||||
|
||||
public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
|
||||
@@ -224,7 +219,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
get
|
||||
{
|
||||
AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES];
|
||||
AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these
|
||||
for (int i = 0; i < MAX_WEARABLES; i++)
|
||||
{
|
||||
defaultWearables[i] = new AvatarWearable();
|
||||
@@ -247,13 +242,10 @@ namespace OpenSim.Framework
|
||||
|
||||
// // Alpha
|
||||
// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);
|
||||
|
||||
// // Tattoo
|
||||
// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
|
||||
|
||||
// // Physics
|
||||
// defaultWearables[PHYSICS].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
|
||||
|
||||
|
||||
// // Tattoo
|
||||
// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
|
||||
|
||||
return defaultWearables;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,14 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public class Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// Must only be accessed under lock.
|
||||
/// </summary>
|
||||
private List<CacheItemBase> m_Index = new List<CacheItemBase>();
|
||||
|
||||
/// <summary>
|
||||
/// Must only be accessed under m_Index lock.
|
||||
/// </summary>
|
||||
private Dictionary<string, CacheItemBase> m_Lookup =
|
||||
new Dictionary<string, CacheItemBase>();
|
||||
|
||||
@@ -320,19 +327,19 @@ namespace OpenSim.Framework
|
||||
{
|
||||
if (m_Lookup.ContainsKey(index))
|
||||
item = m_Lookup[index];
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.Now;
|
||||
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.Now;
|
||||
|
||||
Expire(true);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -385,7 +392,10 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public Object Find(Predicate<CacheItemBase> d)
|
||||
{
|
||||
CacheItemBase item = m_Index.Find(d);
|
||||
CacheItemBase item;
|
||||
|
||||
lock (m_Index)
|
||||
item = m_Index.Find(d);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
@@ -419,12 +429,12 @@ namespace OpenSim.Framework
|
||||
public virtual void Store(string index, Object data, Type container,
|
||||
Object[] parameters)
|
||||
{
|
||||
Expire(false);
|
||||
|
||||
CacheItemBase item;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
Expire(false);
|
||||
|
||||
if (m_Index.Contains(new CacheItemBase(index)))
|
||||
{
|
||||
if ((m_Flags & CacheFlags.AllowUpdate) != 0)
|
||||
@@ -450,9 +460,17 @@ namespace OpenSim.Framework
|
||||
m_Index.Add(item);
|
||||
m_Lookup[index] = item;
|
||||
}
|
||||
|
||||
item.Store(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expire items as appropriate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Callers must lock m_Index.
|
||||
/// </remarks>
|
||||
/// <param name='getting'></param>
|
||||
protected virtual void Expire(bool getting)
|
||||
{
|
||||
if (getting && (m_Strategy == CacheStrategy.Aggressive))
|
||||
@@ -475,12 +493,10 @@ namespace OpenSim.Framework
|
||||
|
||||
switch (m_Strategy)
|
||||
{
|
||||
case CacheStrategy.Aggressive:
|
||||
if (Count < Size)
|
||||
return;
|
||||
case CacheStrategy.Aggressive:
|
||||
if (Count < Size)
|
||||
return;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
m_Index.Sort(new SortLRU());
|
||||
m_Index.Reverse();
|
||||
|
||||
@@ -490,7 +506,7 @@ namespace OpenSim.Framework
|
||||
|
||||
ExpireDelegate doExpire = OnExpire;
|
||||
|
||||
if (doExpire != null)
|
||||
if (doExpire != null)
|
||||
{
|
||||
List<CacheItemBase> candidates =
|
||||
m_Index.GetRange(target, Count - target);
|
||||
@@ -513,27 +529,34 @@ namespace OpenSim.Framework
|
||||
foreach (CacheItemBase item in m_Index)
|
||||
m_Lookup[item.uuid] = item;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(string uuid)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
lock (m_Index)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Index.Clear();
|
||||
m_Lookup.Clear();
|
||||
lock (m_Index)
|
||||
{
|
||||
m_Index.Clear();
|
||||
m_Lookup.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,14 +229,12 @@ namespace OpenSim.Framework
|
||||
|
||||
public class ControllerData
|
||||
{
|
||||
public UUID ObjectID;
|
||||
public UUID ItemID;
|
||||
public uint IgnoreControls;
|
||||
public uint EventControls;
|
||||
|
||||
public ControllerData(UUID obj, UUID item, uint ignore, uint ev)
|
||||
public ControllerData(UUID item, uint ignore, uint ev)
|
||||
{
|
||||
ObjectID = obj;
|
||||
ItemID = item;
|
||||
IgnoreControls = ignore;
|
||||
EventControls = ev;
|
||||
@@ -250,7 +248,6 @@ namespace OpenSim.Framework
|
||||
public OSDMap PackUpdateMessage()
|
||||
{
|
||||
OSDMap controldata = new OSDMap();
|
||||
controldata["object"] = OSD.FromUUID(ObjectID);
|
||||
controldata["item"] = OSD.FromUUID(ItemID);
|
||||
controldata["ignore"] = OSD.FromInteger(IgnoreControls);
|
||||
controldata["event"] = OSD.FromInteger(EventControls);
|
||||
@@ -261,8 +258,6 @@ namespace OpenSim.Framework
|
||||
|
||||
public void UnpackUpdateMessage(OSDMap args)
|
||||
{
|
||||
if (args["object"] != null)
|
||||
ObjectID = args["object"].AsUUID();
|
||||
if (args["item"] != null)
|
||||
ItemID = args["item"].AsUUID();
|
||||
if (args["ignore"] != null)
|
||||
@@ -311,11 +306,8 @@ namespace OpenSim.Framework
|
||||
|
||||
public AgentGroupData[] Groups;
|
||||
public Animation[] Anims;
|
||||
public Animation DefaultAnim = null;
|
||||
|
||||
public UUID GranterID;
|
||||
public UUID ParentPart;
|
||||
public Vector3 SitOffset;
|
||||
|
||||
// Appearance
|
||||
public AvatarAppearance Appearance;
|
||||
@@ -398,11 +390,6 @@ namespace OpenSim.Framework
|
||||
args["animations"] = anims;
|
||||
}
|
||||
|
||||
if (DefaultAnim != null)
|
||||
{
|
||||
args["default_animation"] = DefaultAnim.PackUpdateMessage();
|
||||
}
|
||||
|
||||
if (Appearance != null)
|
||||
args["packed_appearance"] = Appearance.Pack();
|
||||
|
||||
@@ -481,10 +468,6 @@ namespace OpenSim.Framework
|
||||
}
|
||||
args["attach_objects"] = attObjs;
|
||||
}
|
||||
|
||||
args["parent_part"] = OSD.FromUUID(ParentPart);
|
||||
args["sit_offset"] = OSD.FromString(SitOffset.ToString());
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -600,18 +583,6 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
if (args["default_animation"] != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
DefaultAnim = new Animation((OSDMap)args["default_animation"]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
DefaultAnim = null;
|
||||
}
|
||||
}
|
||||
|
||||
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
||||
//{
|
||||
// OSDArray textures = (OSDArray)(args["agent_textures"]);
|
||||
@@ -704,11 +675,6 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args["parent_part"] != null)
|
||||
ParentPart = args["parent_part"].AsUUID();
|
||||
if (args["sit_offset"] != null)
|
||||
Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
|
||||
}
|
||||
|
||||
public AgentData()
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace OpenSim.Framework.Communications
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
_request.KeepAlive = false;
|
||||
_request.ContentType = "application/xml";
|
||||
_request.Timeout = 30000;
|
||||
_request.Timeout = 900000;
|
||||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
_request.ContentLength = src.Length;
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace OpenSim.Framework.Console
|
||||
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
||||
|
||||
m_Server.AddPollServiceHTTPHandler(
|
||||
uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout
|
||||
uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID));
|
||||
|
||||
XmlDocument xmldoc = new XmlDocument();
|
||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||
|
||||
@@ -58,30 +58,6 @@ namespace OpenSim.Framework
|
||||
set { m_EstateName = value; }
|
||||
}
|
||||
|
||||
private bool m_AllowLandmark = true;
|
||||
|
||||
public bool AllowLandmark
|
||||
{
|
||||
get { return m_AllowLandmark; }
|
||||
set { m_AllowLandmark = value; }
|
||||
}
|
||||
|
||||
private bool m_AllowParcelChanges = true;
|
||||
|
||||
public bool AllowParcelChanges
|
||||
{
|
||||
get { return m_AllowParcelChanges; }
|
||||
set { m_AllowParcelChanges = value; }
|
||||
}
|
||||
|
||||
private bool m_AllowSetHome = true;
|
||||
|
||||
public bool AllowSetHome
|
||||
{
|
||||
get { return m_AllowSetHome; }
|
||||
set { m_AllowSetHome = value; }
|
||||
}
|
||||
|
||||
private uint m_ParentEstateID = 1;
|
||||
|
||||
public uint ParentEstateID
|
||||
@@ -362,30 +338,11 @@ namespace OpenSim.Framework
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsBanned(UUID avatarID, int userFlags)
|
||||
public bool IsBanned(UUID avatarID)
|
||||
{
|
||||
foreach (EstateBan ban in l_EstateBans)
|
||||
if (ban.BannedUserID == avatarID)
|
||||
return true;
|
||||
|
||||
if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID))
|
||||
{
|
||||
if (DenyMinors)
|
||||
{
|
||||
if ((userFlags & 32) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (DenyAnonymous)
|
||||
{
|
||||
if ((userFlags & 4) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -393,7 +350,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
if (ban == null)
|
||||
return;
|
||||
if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
|
||||
if (!IsBanned(ban.BannedUserID))
|
||||
l_EstateBans.Add(ban);
|
||||
}
|
||||
|
||||
@@ -417,15 +374,6 @@ namespace OpenSim.Framework
|
||||
return l_EstateAccess.Contains(user);
|
||||
}
|
||||
|
||||
public void SetFromFlags(ulong regionFlags)
|
||||
{
|
||||
ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport);
|
||||
BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell);
|
||||
AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark);
|
||||
AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges);
|
||||
AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome);
|
||||
}
|
||||
|
||||
public bool GroupAccess(UUID groupID)
|
||||
{
|
||||
return l_EstateGroups.Contains(groupID);
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public enum PhysShapeType : byte
|
||||
{
|
||||
prim = 0,
|
||||
none = 1,
|
||||
convex = 2,
|
||||
|
||||
invalid = 255 // use to mark invalid data in ExtraPhysicsData
|
||||
}
|
||||
|
||||
public struct ExtraPhysicsData
|
||||
{
|
||||
public float Density;
|
||||
public float GravitationModifier;
|
||||
public float Friction;
|
||||
public float Bounce;
|
||||
public PhysShapeType PhysShapeType;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -70,8 +70,6 @@ namespace OpenSim.Framework
|
||||
|
||||
public delegate void StopAnim(IClientAPI remoteClient, UUID animID);
|
||||
|
||||
public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack);
|
||||
|
||||
public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children);
|
||||
|
||||
public delegate void DelinkObjects(List<uint> primIds, IClientAPI client);
|
||||
@@ -126,14 +124,12 @@ namespace OpenSim.Framework
|
||||
public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
|
||||
|
||||
public delegate void UpdatePrimFlags(
|
||||
uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient);
|
||||
uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient);
|
||||
|
||||
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
|
||||
|
||||
public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient);
|
||||
|
||||
public delegate void ClientChangeObject(uint localID, object data ,IClientAPI remoteClient);
|
||||
|
||||
public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient);
|
||||
|
||||
public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient);
|
||||
@@ -270,9 +266,6 @@ namespace OpenSim.Framework
|
||||
public delegate void MoveInventoryItem(
|
||||
IClientAPI remoteClient, List<InventoryItemBase> items);
|
||||
|
||||
public delegate void MoveItemsAndLeaveCopy(
|
||||
IClientAPI remoteClient, List<InventoryItemBase> items, UUID destFolder);
|
||||
|
||||
public delegate void RemoveInventoryItem(
|
||||
IClientAPI remoteClient, List<UUID> itemIDs);
|
||||
|
||||
@@ -448,7 +441,6 @@ namespace OpenSim.Framework
|
||||
public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client);
|
||||
public delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client);
|
||||
public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client);
|
||||
public delegate void ClassifiedGodDelete(UUID classifiedID, UUID queryID, IClientAPI client);
|
||||
|
||||
public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client);
|
||||
public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client);
|
||||
@@ -471,9 +463,9 @@ namespace OpenSim.Framework
|
||||
|
||||
public delegate void AgentFOV(IClientAPI client, float verticalAngle);
|
||||
|
||||
public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags);
|
||||
public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID);
|
||||
|
||||
public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name);
|
||||
public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID);
|
||||
|
||||
public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
|
||||
|
||||
@@ -511,7 +503,6 @@ namespace OpenSim.Framework
|
||||
public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID);
|
||||
|
||||
public delegate void SendPostcard(IClientAPI client);
|
||||
public delegate void ChangeInventoryItemFlags(IClientAPI client, UUID itemID, uint flags);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -800,7 +791,6 @@ namespace OpenSim.Framework
|
||||
event ObjectDrop OnObjectDrop;
|
||||
event StartAnim OnStartAnim;
|
||||
event StopAnim OnStopAnim;
|
||||
event ChangeAnim OnChangeAnim;
|
||||
event LinkObjects OnLinkObjects;
|
||||
event DelinkObjects OnDelinkObjects;
|
||||
event RequestMapBlocks OnRequestMapBlocks;
|
||||
@@ -850,7 +840,6 @@ namespace OpenSim.Framework
|
||||
event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
|
||||
event UpdatePrimFlags OnUpdatePrimFlags;
|
||||
event UpdatePrimTexture OnUpdatePrimTexture;
|
||||
event ClientChangeObject onClientChangeObject;
|
||||
event UpdateVector OnUpdatePrimGroupPosition;
|
||||
event UpdateVector OnUpdatePrimSinglePosition;
|
||||
event UpdatePrimRotation OnUpdatePrimGroupRotation;
|
||||
@@ -875,7 +864,6 @@ namespace OpenSim.Framework
|
||||
event RequestTaskInventory OnRequestTaskInventory;
|
||||
event UpdateInventoryItem OnUpdateInventoryItem;
|
||||
event CopyInventoryItem OnCopyInventoryItem;
|
||||
event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
|
||||
event MoveInventoryItem OnMoveInventoryItem;
|
||||
event RemoveInventoryFolder OnRemoveInventoryFolder;
|
||||
event RemoveInventoryItem OnRemoveInventoryItem;
|
||||
@@ -994,7 +982,7 @@ namespace OpenSim.Framework
|
||||
event ClassifiedInfoRequest OnClassifiedInfoRequest;
|
||||
event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
|
||||
event ClassifiedDelete OnClassifiedDelete;
|
||||
event ClassifiedGodDelete OnClassifiedGodDelete;
|
||||
event ClassifiedDelete OnClassifiedGodDelete;
|
||||
|
||||
event EventNotificationAddRequest OnEventNotificationAddRequest;
|
||||
event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
|
||||
@@ -1033,7 +1021,6 @@ namespace OpenSim.Framework
|
||||
event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
|
||||
event SimWideDeletesDelegate OnSimWideDeletes;
|
||||
event SendPostcard OnSendPostcard;
|
||||
event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
|
||||
event MuteListEntryUpdate OnUpdateMuteListEntry;
|
||||
event MuteListEntryRemove OnRemoveMuteListEntry;
|
||||
event GodlikeMessage onGodlikeMessage;
|
||||
@@ -1046,8 +1033,21 @@ namespace OpenSim.Framework
|
||||
|
||||
void InPacket(object NewPack);
|
||||
void ProcessInPacket(Packet NewPack);
|
||||
|
||||
/// <summary>
|
||||
/// Close this client
|
||||
/// </summary>
|
||||
void Close();
|
||||
void Close(bool sendStop);
|
||||
|
||||
/// <summary>
|
||||
/// Close this client
|
||||
/// </summary>
|
||||
/// <param name='force'>
|
||||
/// If true, attempts the close without checking active status. You do not want to try this except as a last
|
||||
/// ditch attempt where Active == false but the ScenePresence still exists.
|
||||
/// </param>
|
||||
void Close(bool force);
|
||||
|
||||
void Kick(string message);
|
||||
|
||||
/// <summary>
|
||||
@@ -1177,7 +1177,7 @@ namespace OpenSim.Framework
|
||||
/// <param name="node"></param>
|
||||
void SendBulkUpdateInventory(InventoryNodeBase node);
|
||||
|
||||
void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory);
|
||||
void SendXferPacket(ulong xferID, uint packet, byte[] data);
|
||||
|
||||
void SendAbortXferPacket(ulong xferID);
|
||||
|
||||
@@ -1329,8 +1329,6 @@ namespace OpenSim.Framework
|
||||
|
||||
void SendObjectPropertiesReply(ISceneEntity Entity);
|
||||
|
||||
void SendPartPhysicsProprieties(ISceneEntity Entity);
|
||||
|
||||
void SendAgentOffline(UUID[] agentIDs);
|
||||
|
||||
void SendAgentOnline(UUID[] agentIDs);
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace OpenSim.Framework
|
||||
bool AmountCovered(UUID agentID, int amount);
|
||||
void ApplyCharge(UUID agentID, int amount, string text);
|
||||
void ApplyUploadCharge(UUID agentID, int amount, string text);
|
||||
void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
|
||||
|
||||
int UploadCharge { get; }
|
||||
int GroupCreationCharge { get; }
|
||||
|
||||
@@ -73,33 +73,27 @@ namespace OpenSim.Framework
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id)
|
||||
public InventoryFolderBase(UUID id) : this()
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, UUID owner)
|
||||
public InventoryFolderBase(UUID id, UUID owner) : this(id)
|
||||
{
|
||||
ID = id;
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
ParentID = parent;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
|
||||
public InventoryFolderBase(
|
||||
UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
Type = type;
|
||||
ParentID = parent;
|
||||
Version = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace OpenSim.Framework
|
||||
|
||||
private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
|
||||
(uint) ParcelFlags.AllowAPrimitiveEntry |
|
||||
(uint) ParcelFlags.AllowDeedToGroup |
|
||||
(uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
|
||||
(uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
|
||||
(uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
|
||||
|
||||
|
||||
@@ -43,30 +43,18 @@ namespace OpenSim.Framework.Monitoring
|
||||
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
||||
sb.Append("MEMORY STATISTICS");
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Allocated to OpenSim objects: {0} MB\n",
|
||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
|
||||
|
||||
Process myprocess = Process.GetCurrentProcess();
|
||||
if (!myprocess.HasExited)
|
||||
{
|
||||
myprocess.Refresh();
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
||||
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0),
|
||||
Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0),
|
||||
Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)));
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
||||
Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0),
|
||||
Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0),
|
||||
Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)));
|
||||
}
|
||||
else
|
||||
sb.Append("Process reported as Exited \n");
|
||||
sb.AppendFormat(
|
||||
"Allocated to OpenSim objects: {0} MB\n",
|
||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
|
||||
|
||||
sb.AppendFormat(
|
||||
"OpenSim object memory churn : {0} MB/s\n",
|
||||
Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
|
||||
|
||||
sb.AppendFormat(
|
||||
"Process memory : {0} MB\n",
|
||||
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -89,6 +89,17 @@ namespace OpenSim.Framework.Monitoring
|
||||
FirstTick = Environment.TickCount & Int32.MaxValue;
|
||||
LastTick = FirstTick;
|
||||
}
|
||||
|
||||
public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
|
||||
{
|
||||
Thread = previousTwi.Thread;
|
||||
FirstTick = previousTwi.FirstTick;
|
||||
LastTick = previousTwi.LastTick;
|
||||
Timeout = previousTwi.Timeout;
|
||||
IsTimedOut = previousTwi.IsTimedOut;
|
||||
AlarmIfTimeout = previousTwi.AlarmIfTimeout;
|
||||
AlarmMethod = previousTwi.AlarmMethod;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -335,7 +346,9 @@ namespace OpenSim.Framework.Monitoring
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
// Send a copy of the watchdog info to prevent race conditions where the watchdog
|
||||
// thread updates the monitoring info after an alarm has been sent out.
|
||||
callbackInfos.Add(new ThreadWatchdogInfo(threadInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,4 +365,4 @@ namespace OpenSim.Framework.Monitoring
|
||||
m_watchdogTimer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,11 +51,12 @@ namespace OpenSim.Framework
|
||||
protected object m_senderObject;
|
||||
protected ChatTypeEnum m_type;
|
||||
protected UUID m_fromID;
|
||||
protected UUID m_destination = UUID.Zero;
|
||||
protected UUID m_toID;
|
||||
|
||||
public OSChatMessage()
|
||||
{
|
||||
m_position = new Vector3();
|
||||
m_toID = UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -103,6 +104,15 @@ namespace OpenSim.Framework
|
||||
set { m_from = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of the sender (needed for scripts)
|
||||
/// </summary>
|
||||
public string To
|
||||
{
|
||||
get { return m_from; }
|
||||
set { m_from = value; }
|
||||
}
|
||||
|
||||
#region IEventArgs Members
|
||||
|
||||
/// TODO: Sender and SenderObject should just be Sender and of
|
||||
@@ -132,10 +142,13 @@ namespace OpenSim.Framework
|
||||
set { m_fromID = value; }
|
||||
}
|
||||
|
||||
public UUID Destination
|
||||
/// <summary>
|
||||
/// The single recipient or all if not set.
|
||||
/// </summary>
|
||||
public UUID TargetUUID
|
||||
{
|
||||
get { return m_destination; }
|
||||
set { m_destination = value; }
|
||||
get { return m_toID; }
|
||||
set { m_toID = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public enum ObjectChangeType : uint
|
||||
{
|
||||
// bits definitions
|
||||
Position = 0x01,
|
||||
Rotation = 0x02,
|
||||
Scale = 0x04,
|
||||
Group = 0x08,
|
||||
UniformScale = 0x10,
|
||||
|
||||
// macros from above
|
||||
// single prim
|
||||
primP = 0x01,
|
||||
primR = 0x02,
|
||||
primPR = 0x03,
|
||||
primS = 0x04,
|
||||
primPS = 0x05,
|
||||
primRS = 0x06,
|
||||
primPSR = 0x07,
|
||||
|
||||
primUS = 0x14,
|
||||
primPUS = 0x15,
|
||||
primRUS = 0x16,
|
||||
primPUSR = 0x17,
|
||||
|
||||
// group
|
||||
groupP = 0x09,
|
||||
groupR = 0x0A,
|
||||
groupPR = 0x0B,
|
||||
groupS = 0x0C,
|
||||
groupPS = 0x0D,
|
||||
groupRS = 0x0E,
|
||||
groupPSR = 0x0F,
|
||||
|
||||
groupUS = 0x1C,
|
||||
groupPUS = 0x1D,
|
||||
groupRUS = 0x1E,
|
||||
groupPUSR = 0x1F,
|
||||
|
||||
PRSmask = 0x07
|
||||
}
|
||||
|
||||
public struct ObjectChangeData
|
||||
{
|
||||
public Quaternion rotation;
|
||||
public Vector3 position;
|
||||
public Vector3 scale;
|
||||
public ObjectChangeType change;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public enum ParcelMediaCommandEnum : int
|
||||
public enum ParcelMediaCommandEnum
|
||||
{
|
||||
Stop = 0,
|
||||
Pause = 1,
|
||||
|
||||
@@ -244,22 +244,13 @@ namespace OpenSim.Framework
|
||||
// The Mono addin manager (in Mono.Addins.dll version 0.2.0.0)
|
||||
// occasionally seems to corrupt its addin cache
|
||||
// Hence, as a temporary solution we'll remove it before each startup
|
||||
|
||||
string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY");
|
||||
string v0 = "addin-db-000";
|
||||
string v1 = "addin-db-001";
|
||||
if (customDir != null && customDir != String.Empty)
|
||||
{
|
||||
v0 = Path.Combine(customDir, v0);
|
||||
v1 = Path.Combine(customDir, v1);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(v0))
|
||||
Directory.Delete(v0, true);
|
||||
if (Directory.Exists("addin-db-000"))
|
||||
Directory.Delete("addin-db-000", true);
|
||||
|
||||
if (Directory.Exists(v1))
|
||||
Directory.Delete(v1, true);
|
||||
if (Directory.Exists("addin-db-001"))
|
||||
Directory.Delete("addin-db-001", true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
@@ -724,12 +724,7 @@ namespace OpenSim.Framework
|
||||
return _lightColorR;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
_lightColorR = 0;
|
||||
else if (value > 1.0f)
|
||||
_lightColorR = 1.0f;
|
||||
else
|
||||
_lightColorR = value;
|
||||
_lightColorR = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -738,12 +733,7 @@ namespace OpenSim.Framework
|
||||
return _lightColorG;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
_lightColorG = 0;
|
||||
else if (value > 1.0f)
|
||||
_lightColorG = 1.0f;
|
||||
else
|
||||
_lightColorG = value;
|
||||
_lightColorG = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -752,12 +742,7 @@ namespace OpenSim.Framework
|
||||
return _lightColorB;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
_lightColorB = 0;
|
||||
else if (value > 1.0f)
|
||||
_lightColorB = 1.0f;
|
||||
else
|
||||
_lightColorB = value;
|
||||
_lightColorB = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,12 +751,7 @@ namespace OpenSim.Framework
|
||||
return _lightColorA;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
_lightColorA = 0;
|
||||
else if (value > 1.0f)
|
||||
_lightColorA = 1.0f;
|
||||
else
|
||||
_lightColorA = value;
|
||||
_lightColorA = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,11 +864,6 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
public ulong GetMeshKey(Vector3 size, float lod)
|
||||
{
|
||||
return GetMeshKey(size, lod, false);
|
||||
}
|
||||
|
||||
public ulong GetMeshKey(Vector3 size, float lod, bool convex)
|
||||
{
|
||||
ulong hash = 5381;
|
||||
|
||||
@@ -935,9 +910,6 @@ namespace OpenSim.Framework
|
||||
hash = djb2(hash, scaleBytes[i]);
|
||||
}
|
||||
|
||||
if(convex)
|
||||
hash = djb2(hash, 0xa5);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -1442,7 +1414,7 @@ namespace OpenSim.Framework
|
||||
prim.Textures = this.Textures;
|
||||
|
||||
prim.Properties = new Primitive.ObjectProperties();
|
||||
prim.Properties.Name = "Object";
|
||||
prim.Properties.Name = "Primitive";
|
||||
prim.Properties.Description = "";
|
||||
prim.Properties.CreatorID = UUID.Zero;
|
||||
prim.Properties.GroupID = UUID.Zero;
|
||||
|
||||
@@ -40,7 +40,6 @@ using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
[Serializable]
|
||||
public class RegionLightShareData : ICloneable
|
||||
{
|
||||
public bool valid = false;
|
||||
@@ -103,7 +102,6 @@ namespace OpenSim.Framework
|
||||
|
||||
public bool commFailTF = false;
|
||||
public ConfigurationMember configMember;
|
||||
public string DataStore = String.Empty;
|
||||
public string RegionFile = String.Empty;
|
||||
public bool isSandbox = false;
|
||||
public bool Persistent = true;
|
||||
@@ -122,7 +120,9 @@ namespace OpenSim.Framework
|
||||
public UUID lastMapUUID = UUID.Zero;
|
||||
public string lastMapRefresh = "0";
|
||||
|
||||
private float m_nonphysPrimMin = 0;
|
||||
private int m_nonphysPrimMax = 0;
|
||||
private float m_physPrimMin = 0;
|
||||
private int m_physPrimMax = 0;
|
||||
private bool m_clampPrimSize = false;
|
||||
private int m_objectCapacity = 0;
|
||||
@@ -287,11 +287,21 @@ namespace OpenSim.Framework
|
||||
set { m_windlight = value; }
|
||||
}
|
||||
|
||||
public float NonphysPrimMin
|
||||
{
|
||||
get { return m_nonphysPrimMin; }
|
||||
}
|
||||
|
||||
public int NonphysPrimMax
|
||||
{
|
||||
get { return m_nonphysPrimMax; }
|
||||
}
|
||||
|
||||
public float PhysPrimMin
|
||||
{
|
||||
get { return m_physPrimMin; }
|
||||
}
|
||||
|
||||
public int PhysPrimMax
|
||||
{
|
||||
get { return m_physPrimMax; }
|
||||
@@ -625,16 +635,28 @@ namespace OpenSim.Framework
|
||||
m_regionType = config.GetString("RegionType", String.Empty);
|
||||
allKeys.Remove("RegionType");
|
||||
|
||||
// Prim stuff
|
||||
//
|
||||
#region Prim stuff
|
||||
|
||||
m_nonphysPrimMin = config.GetFloat("NonphysicalPrimMin", 0);
|
||||
allKeys.Remove("NonphysicalPrimMin");
|
||||
|
||||
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0);
|
||||
allKeys.Remove("NonphysicalPrimMax");
|
||||
|
||||
m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0);
|
||||
allKeys.Remove("PhysicalPrimMin");
|
||||
|
||||
m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
|
||||
allKeys.Remove("PhysicalPrimMax");
|
||||
|
||||
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
||||
allKeys.Remove("ClampPrimSize");
|
||||
|
||||
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
||||
allKeys.Remove("MaxPrims");
|
||||
|
||||
#endregion
|
||||
|
||||
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
||||
allKeys.Remove("MaxAgents");
|
||||
|
||||
@@ -663,9 +685,6 @@ namespace OpenSim.Framework
|
||||
string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY);
|
||||
config.Set("Location", location);
|
||||
|
||||
if (DataStore != String.Empty)
|
||||
config.Set("Datastore", DataStore);
|
||||
|
||||
config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
|
||||
config.Set("InternalPort", m_internalEndPoint.Port);
|
||||
|
||||
@@ -673,10 +692,18 @@ namespace OpenSim.Framework
|
||||
|
||||
config.Set("ExternalHostName", m_externalHostName);
|
||||
|
||||
if (m_nonphysPrimMin != 0)
|
||||
config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
|
||||
|
||||
if (m_nonphysPrimMax != 0)
|
||||
config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
|
||||
|
||||
if (m_physPrimMin != 0)
|
||||
config.Set("PhysicalPrimMax", m_physPrimMin);
|
||||
|
||||
if (m_physPrimMax != 0)
|
||||
config.Set("PhysicalPrimMax", m_physPrimMax);
|
||||
|
||||
config.Set("ClampPrimSize", m_clampPrimSize.ToString());
|
||||
|
||||
if (m_objectCapacity != 0)
|
||||
@@ -759,9 +786,15 @@ namespace OpenSim.Framework
|
||||
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
|
||||
"Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
|
||||
"Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
"Maximum size for physical prims", m_physPrimMax.ToString(), true);
|
||||
|
||||
@@ -851,9 +884,6 @@ namespace OpenSim.Framework
|
||||
case "sim_location_y":
|
||||
m_regionLocY = (uint) configuration_result;
|
||||
break;
|
||||
case "datastore":
|
||||
DataStore = (string) configuration_result;
|
||||
break;
|
||||
case "internal_ip_address":
|
||||
IPAddress address = (IPAddress) configuration_result;
|
||||
m_internalEndPoint = new IPEndPoint(address, 0);
|
||||
@@ -1004,11 +1034,6 @@ namespace OpenSim.Framework
|
||||
return regionInfo;
|
||||
}
|
||||
|
||||
public int getInternalEndPointPort()
|
||||
{
|
||||
return m_internalEndPoint.Port;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs()
|
||||
{
|
||||
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
||||
@@ -1027,4 +1052,4 @@ namespace OpenSim.Framework
|
||||
return kvp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,6 @@ namespace OpenSim.Framework.RegionLoader.Web
|
||||
|
||||
public RegionInfo[] LoadRegions()
|
||||
{
|
||||
int tries = 3;
|
||||
int wait = 2000;
|
||||
|
||||
if (m_configSource == null)
|
||||
{
|
||||
m_log.Error("[WEBLOADER]: Unable to load configuration source!");
|
||||
@@ -69,72 +66,63 @@ namespace OpenSim.Framework.RegionLoader.Web
|
||||
}
|
||||
else
|
||||
{
|
||||
while(tries > 0)
|
||||
{
|
||||
RegionInfo[] regionInfos = new RegionInfo[] {};
|
||||
int regionCount = 0;
|
||||
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
||||
webRequest.Timeout = 30000; //30 Second Timeout
|
||||
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
||||
RegionInfo[] regionInfos = new RegionInfo[] {};
|
||||
int regionCount = 0;
|
||||
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
||||
webRequest.Timeout = 30000; //30 Second Timeout
|
||||
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
|
||||
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
||||
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
||||
string xmlSource = String.Empty;
|
||||
string tempStr = reader.ReadLine();
|
||||
while (tempStr != null)
|
||||
{
|
||||
xmlSource = xmlSource + tempStr;
|
||||
tempStr = reader.ReadLine();
|
||||
}
|
||||
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
|
||||
xmlSource.Length);
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(xmlSource);
|
||||
if (xmlDoc.FirstChild.Name == "Regions")
|
||||
{
|
||||
regionCount = xmlDoc.FirstChild.ChildNodes.Count;
|
||||
|
||||
if (regionCount > 0)
|
||||
{
|
||||
regionInfos = new RegionInfo[regionCount];
|
||||
int i;
|
||||
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
|
||||
{
|
||||
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
||||
regionInfos[i] =
|
||||
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
if (!allowRegionless)
|
||||
throw ex;
|
||||
}
|
||||
else
|
||||
throw ex;
|
||||
}
|
||||
|
||||
if (regionCount > 0 | allowRegionless)
|
||||
return regionInfos;
|
||||
|
||||
m_log.Debug("[WEBLOADER]: Request yielded no regions.");
|
||||
tries--;
|
||||
if (tries > 0)
|
||||
try
|
||||
{
|
||||
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
|
||||
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
||||
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
||||
string xmlSource = String.Empty;
|
||||
string tempStr = reader.ReadLine();
|
||||
while (tempStr != null)
|
||||
{
|
||||
m_log.Debug("[WEBLOADER]: Retrying");
|
||||
System.Threading.Thread.Sleep(wait);
|
||||
xmlSource = xmlSource + tempStr;
|
||||
tempStr = reader.ReadLine();
|
||||
}
|
||||
}
|
||||
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
|
||||
xmlSource.Length);
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(xmlSource);
|
||||
if (xmlDoc.FirstChild.Name == "Regions")
|
||||
{
|
||||
regionCount = xmlDoc.FirstChild.ChildNodes.Count;
|
||||
|
||||
if (regionCount > 0)
|
||||
{
|
||||
regionInfos = new RegionInfo[regionCount];
|
||||
int i;
|
||||
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
|
||||
{
|
||||
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
||||
regionInfos[i] =
|
||||
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
if (!allowRegionless)
|
||||
throw ex;
|
||||
}
|
||||
else
|
||||
throw ex;
|
||||
}
|
||||
|
||||
m_log.Error("[WEBLOADER]: No region configs were available.");
|
||||
return null;
|
||||
if (regionCount > 0 | allowRegionless)
|
||||
return regionInfos;
|
||||
else
|
||||
{
|
||||
m_log.Error("[WEBLOADER]: No region configs were available.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,28 +482,6 @@ namespace OpenSim.Framework
|
||||
set { m_LoadedCreationID = value; }
|
||||
}
|
||||
|
||||
private bool m_GodBlockSearch = false;
|
||||
public bool GodBlockSearch
|
||||
{
|
||||
get { return m_GodBlockSearch; }
|
||||
set { m_GodBlockSearch = value; }
|
||||
}
|
||||
|
||||
private bool m_Casino = false;
|
||||
public bool Casino
|
||||
{
|
||||
get { return m_Casino; }
|
||||
set { m_Casino = value; }
|
||||
}
|
||||
|
||||
// Telehub support
|
||||
private bool m_TelehubEnabled = false;
|
||||
public bool HasTelehub
|
||||
{
|
||||
get { return m_TelehubEnabled; }
|
||||
set { m_TelehubEnabled = value; }
|
||||
}
|
||||
|
||||
// Connected Telehub object
|
||||
private UUID m_TelehubObject = UUID.Zero;
|
||||
public UUID TelehubObject
|
||||
|
||||
@@ -65,9 +65,14 @@ namespace OpenSim.Framework.Serialization
|
||||
|
||||
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
||||
if (account != null)
|
||||
{
|
||||
return MakeOspa(account.FirstName, account.LastName);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId);
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -79,10 +84,13 @@ namespace OpenSim.Framework.Serialization
|
||||
/// <returns></returns>
|
||||
public static string MakeOspa(string firstName, string lastName)
|
||||
{
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
|
||||
string ospa
|
||||
= OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
|
||||
return
|
||||
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
return ospa;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace OpenSim.Framework.Servers
|
||||
|
||||
EnhanceVersionInformation();
|
||||
|
||||
m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine);
|
||||
m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine);
|
||||
// clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
|
||||
// the clr version number doesn't match the project version number under Mono.
|
||||
//m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
|
||||
|
||||
@@ -1448,34 +1448,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
|
||||
{
|
||||
int responsecode;
|
||||
string responseString;
|
||||
string contentType;
|
||||
|
||||
if (responsedata == null)
|
||||
{
|
||||
responsecode = 500;
|
||||
responseString = "No response could be obtained";
|
||||
contentType = "text/plain";
|
||||
responsedata = new Hashtable();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
//m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
|
||||
responsecode = (int)responsedata["int_response_code"];
|
||||
responseString = (string)responsedata["str_response_string"];
|
||||
contentType = (string)responsedata["content_type"];
|
||||
}
|
||||
catch
|
||||
{
|
||||
responsecode = 500;
|
||||
responseString = "No response could be obtained";
|
||||
contentType = "text/plain";
|
||||
responsedata = new Hashtable();
|
||||
}
|
||||
}
|
||||
//m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
|
||||
int responsecode = (int)responsedata["int_response_code"];
|
||||
string responseString = (string)responsedata["str_response_string"];
|
||||
string contentType = (string)responsedata["content_type"];
|
||||
|
||||
if (responsedata.ContainsKey("error_status_text"))
|
||||
{
|
||||
@@ -1652,9 +1628,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public void httpServerException(object source, Exception exception)
|
||||
{
|
||||
if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException"))
|
||||
return;
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
|
||||
m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception);
|
||||
/*
|
||||
if (HTTPDRunning)// && NotSocketErrors > 5)
|
||||
{
|
||||
|
||||
@@ -45,28 +45,17 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public NoEventsMethod NoEvents;
|
||||
public RequestMethod Request;
|
||||
public UUID Id;
|
||||
public int TimeOutms;
|
||||
public EventType Type;
|
||||
|
||||
public enum EventType : int
|
||||
{
|
||||
Normal = 0,
|
||||
LslHttp = 1,
|
||||
Inventory = 2
|
||||
}
|
||||
|
||||
public PollServiceEventArgs(
|
||||
RequestMethod pRequest,
|
||||
HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,
|
||||
UUID pId, int pTimeOutms)
|
||||
UUID pId)
|
||||
{
|
||||
Request = pRequest;
|
||||
HasEvents = pHasEvents;
|
||||
GetEvents = pGetEvents;
|
||||
NoEvents = pNoEvents;
|
||||
Id = pId;
|
||||
TimeOutms = pTimeOutms;
|
||||
Type = EventType.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,18 +34,14 @@ using HttpServer;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
|
||||
/*
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
||||
public class PollServiceRequestManager
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly BaseHttpServer m_server;
|
||||
private static Queue m_requests = Queue.Synchronized(new Queue());
|
||||
private static ManualResetEvent m_ev = new ManualResetEvent(false);
|
||||
private uint m_WorkerThreadCount = 0;
|
||||
private Thread[] m_workerThreads;
|
||||
private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
|
||||
@@ -71,6 +67,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
@@ -80,6 +77,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
@@ -93,17 +91,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
lock (m_requests)
|
||||
m_requests.Enqueue(req);
|
||||
m_ev.Set();
|
||||
}
|
||||
|
||||
public void ThreadStart()
|
||||
{
|
||||
while (m_running)
|
||||
{
|
||||
m_ev.WaitOne(1000);
|
||||
m_ev.Reset();
|
||||
Watchdog.UpdateThread();
|
||||
ProcessQueuedRequests();
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,9 +141,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
foreach (object o in m_requests)
|
||||
{
|
||||
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
|
||||
m_server.DoHTTPGruntWork(
|
||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
|
||||
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
|
||||
PollServiceWorkerThread.DoHTTPGruntWork(
|
||||
m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||
}
|
||||
|
||||
m_requests.Clear();
|
||||
@@ -156,279 +151,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
t.Abort();
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class PollServiceRequestManager
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly BaseHttpServer m_server;
|
||||
|
||||
private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>();
|
||||
private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>();
|
||||
private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>();
|
||||
|
||||
private uint m_WorkerThreadCount = 0;
|
||||
private Thread[] m_workerThreads;
|
||||
private Thread m_retrysThread;
|
||||
|
||||
private bool m_running = true;
|
||||
private int slowCount = 0;
|
||||
|
||||
// private int m_timeout = 1000; // increase timeout 250; now use the event one
|
||||
|
||||
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
|
||||
{
|
||||
m_server = pSrv;
|
||||
m_WorkerThreadCount = pWorkerThreadCount;
|
||||
m_workerThreads = new Thread[m_WorkerThreadCount];
|
||||
|
||||
//startup worker threads
|
||||
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
||||
{
|
||||
m_workerThreads[i]
|
||||
= Watchdog.StartThread(
|
||||
PoolWorkerJob,
|
||||
String.Format("PollServiceWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
m_retrysThread = Watchdog.StartThread(
|
||||
this.CheckRetries,
|
||||
"PollServiceWatcherThread",
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
|
||||
private void ReQueueEvent(PollServiceHttpRequest req)
|
||||
{
|
||||
if (m_running)
|
||||
{
|
||||
lock (m_retryRequests)
|
||||
m_retryRequests.Enqueue(req);
|
||||
}
|
||||
}
|
||||
|
||||
public void Enqueue(PollServiceHttpRequest req)
|
||||
{
|
||||
if (m_running)
|
||||
{
|
||||
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp ||
|
||||
req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Inventory)
|
||||
{
|
||||
m_requests.Enqueue(req);
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (m_slowRequests)
|
||||
m_slowRequests.Enqueue(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRetries()
|
||||
{
|
||||
while (m_running)
|
||||
{
|
||||
Thread.Sleep(100); // let the world move .. back to faster rate
|
||||
Watchdog.UpdateThread();
|
||||
lock (m_retryRequests)
|
||||
{
|
||||
while (m_retryRequests.Count > 0 && m_running)
|
||||
m_requests.Enqueue(m_retryRequests.Dequeue());
|
||||
}
|
||||
slowCount++;
|
||||
if (slowCount >= 10)
|
||||
{
|
||||
slowCount = 0;
|
||||
|
||||
lock (m_slowRequests)
|
||||
{
|
||||
while (m_slowRequests.Count > 0 && m_running)
|
||||
m_requests.Enqueue(m_slowRequests.Dequeue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~PollServiceRequestManager()
|
||||
{
|
||||
m_running = false;
|
||||
// m_timeout = -10000; // cause all to expire
|
||||
Thread.Sleep(1000); // let the world move
|
||||
|
||||
foreach (Thread t in m_workerThreads)
|
||||
{
|
||||
try
|
||||
{
|
||||
t.Abort();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (PollServiceHttpRequest req in m_retryRequests)
|
||||
{
|
||||
DoHTTPGruntWork(m_server,req,
|
||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
PollServiceHttpRequest wreq;
|
||||
m_retryRequests.Clear();
|
||||
|
||||
lock (m_slowRequests)
|
||||
{
|
||||
while (m_slowRequests.Count > 0 && m_running)
|
||||
m_requests.Enqueue(m_slowRequests.Dequeue());
|
||||
}
|
||||
|
||||
while (m_requests.Count() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
wreq = m_requests.Dequeue(0);
|
||||
DoHTTPGruntWork(m_server,wreq,
|
||||
wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
m_requests.Clear();
|
||||
}
|
||||
|
||||
// work threads
|
||||
|
||||
private void PoolWorkerJob()
|
||||
{
|
||||
PollServiceHttpRequest req;
|
||||
StreamReader str;
|
||||
|
||||
// while (true)
|
||||
while (m_running)
|
||||
{
|
||||
req = m_requests.Dequeue(5000);
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
if (req != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||
{
|
||||
try
|
||||
{
|
||||
str = new StreamReader(req.Request.Body);
|
||||
}
|
||||
catch (System.ArgumentException)
|
||||
{
|
||||
// Stream was not readable means a child agent
|
||||
// was closed due to logout, leaving the
|
||||
// Event Queue request orphaned.
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
DoHTTPGruntWork(m_server, req, responsedata);
|
||||
}
|
||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||
{
|
||||
// Ignore it, no need to reply
|
||||
}
|
||||
|
||||
str.Close();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// if ((Environment.TickCount - req.RequestTime) > m_timeout)
|
||||
|
||||
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
||||
{
|
||||
DoHTTPGruntWork(m_server, req,
|
||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ReQueueEvent(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DoHTTPGruntWork changed, not sending response
|
||||
// do the same work around as core
|
||||
|
||||
internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata)
|
||||
{
|
||||
OSHttpResponse response
|
||||
= new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
|
||||
|
||||
byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex));
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.OutputStream.Flush();
|
||||
response.Send();
|
||||
|
||||
//if (!response.KeepAlive && response.ReuseContext)
|
||||
// response.FreeContext();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,6 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Ubit work moved to PollServiceRequestManager
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -92,15 +90,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
DoHTTPGruntWork(m_server, req, responsedata);
|
||||
}
|
||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||
{
|
||||
// Ignore it, no need to reply
|
||||
}
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
DoHTTPGruntWork(m_server, req, responsedata);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -171,5 +162,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -29,11 +29,11 @@ namespace OpenSim
|
||||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.4CM";
|
||||
private const string VERSION_NUMBER = "0.7.5";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
{
|
||||
Unknown,
|
||||
Dev,
|
||||
RC1,
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim
|
||||
|
||||
public static string GetVersionString(string versionNumber, Flavour flavour)
|
||||
{
|
||||
string versionString = "Careminster " + versionNumber + " " + flavour;
|
||||
string versionString = "OpenSim " + versionNumber + " " + flavour;
|
||||
return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
@@ -49,180 +45,6 @@ namespace OpenSim.Framework
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Thread LockedByThread;
|
||||
// private string WriterStack;
|
||||
|
||||
// private Dictionary<Thread, string> ReadLockers =
|
||||
// new Dictionary<Thread, string>();
|
||||
|
||||
/// <value>
|
||||
/// An advanced lock for inventory data
|
||||
/// </value>
|
||||
private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
|
||||
/// <summary>
|
||||
/// Are we readlocked by the calling thread?
|
||||
/// </summary>
|
||||
public bool IsReadLockedByMe()
|
||||
{
|
||||
if (m_itemLock.RecursiveReadCount > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lock our inventory list for reading (many can read, one can write)
|
||||
/// </summary>
|
||||
public void LockItemsForRead(bool locked)
|
||||
{
|
||||
if (locked)
|
||||
{
|
||||
if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
|
||||
{
|
||||
if (!LockedByThread.IsAlive)
|
||||
{
|
||||
//Locked by dead thread, reset.
|
||||
m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_itemLock.RecursiveReadCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
|
||||
try
|
||||
{
|
||||
// That call stack is useful for end users only. RealProgrammers need a full dump. Commented.
|
||||
// StackTrace stackTrace = new StackTrace(); // get call stack
|
||||
// StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
|
||||
//
|
||||
// // write call stack method names
|
||||
// foreach (StackFrame stackFrame in stackFrames)
|
||||
// {
|
||||
// m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name
|
||||
// }
|
||||
|
||||
// The below is far more useful
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// foreach (KeyValuePair<Thread, string> kvp in ReadLockers)
|
||||
// {
|
||||
// System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// }
|
||||
}
|
||||
catch
|
||||
{}
|
||||
m_itemLock.ExitReadLock();
|
||||
}
|
||||
if (m_itemLock.RecursiveWriteCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
|
||||
// try
|
||||
// {
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// }
|
||||
// catch
|
||||
// {}
|
||||
m_itemLock.ExitWriteLock();
|
||||
}
|
||||
|
||||
while (!m_itemLock.TryEnterReadLock(60000))
|
||||
{
|
||||
m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
|
||||
if (m_itemLock.IsWriteLockHeld)
|
||||
{
|
||||
m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// LockedByThread = null;
|
||||
// ReadLockers.Clear();
|
||||
}
|
||||
}
|
||||
// ReadLockers[Thread.CurrentThread] = Environment.StackTrace;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_itemLock.RecursiveReadCount>0)
|
||||
{
|
||||
m_itemLock.ExitReadLock();
|
||||
}
|
||||
// if (m_itemLock.RecursiveReadCount == 0)
|
||||
// ReadLockers.Remove(Thread.CurrentThread);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lock our inventory list for writing (many can read, one can write)
|
||||
/// </summary>
|
||||
public void LockItemsForWrite(bool locked)
|
||||
{
|
||||
if (locked)
|
||||
{
|
||||
//Enter a write lock, wait indefinately for one to open.
|
||||
if (m_itemLock.RecursiveReadCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
|
||||
m_itemLock.ExitReadLock();
|
||||
}
|
||||
if (m_itemLock.RecursiveWriteCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
|
||||
|
||||
m_itemLock.ExitWriteLock();
|
||||
}
|
||||
while (!m_itemLock.TryEnterWriteLock(60000))
|
||||
{
|
||||
if (m_itemLock.IsWriteLockHeld)
|
||||
{
|
||||
m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// foreach (KeyValuePair<Thread, string> kvp in ReadLockers)
|
||||
// {
|
||||
// System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name);
|
||||
// System.Console.WriteLine("------------------------------------------");
|
||||
// }
|
||||
}
|
||||
m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
// ReadLockers.Clear();
|
||||
}
|
||||
|
||||
LockedByThread = Thread.CurrentThread;
|
||||
// WriterStack = Environment.StackTrace;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_itemLock.RecursiveWriteCount > 0)
|
||||
{
|
||||
m_itemLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ICloneable Members
|
||||
|
||||
@@ -230,13 +52,14 @@ namespace OpenSim.Framework
|
||||
{
|
||||
TaskInventoryDictionary clone = new TaskInventoryDictionary();
|
||||
|
||||
m_itemLock.EnterReadLock();
|
||||
foreach (UUID uuid in Keys)
|
||||
lock (this)
|
||||
{
|
||||
clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
|
||||
foreach (UUID uuid in Keys)
|
||||
{
|
||||
clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
|
||||
}
|
||||
}
|
||||
m_itemLock.ExitReadLock();
|
||||
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenSim.Framework
|
||||
private UUID _loadedID = UUID.Zero;
|
||||
|
||||
private bool _ownerChanged = false;
|
||||
|
||||
|
||||
// This used ONLY during copy. It can't be relied on at other times!
|
||||
private bool _scriptRunning = true;
|
||||
|
||||
|
||||
@@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests
|
||||
BannedHostNameMask = string.Empty,
|
||||
BannedUserID = bannedUserId}
|
||||
);
|
||||
Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not.");
|
||||
Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is.");
|
||||
Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not.");
|
||||
Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is.");
|
||||
|
||||
es.RemoveBan(bannedUserId);
|
||||
|
||||
Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is.");
|
||||
Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is.");
|
||||
|
||||
es.AddEstateManager(UUID.Zero);
|
||||
|
||||
|
||||
@@ -481,25 +481,19 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public static string Md5Hash(string data)
|
||||
{
|
||||
return Md5Hash(data, Encoding.Default);
|
||||
}
|
||||
|
||||
public static string Md5Hash(string data, Encoding encoding)
|
||||
{
|
||||
byte[] dataMd5 = ComputeMD5Hash(data, encoding);
|
||||
byte[] dataMd5 = ComputeMD5Hash(data);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < dataMd5.Length; i++)
|
||||
sb.AppendFormat("{0:x2}", dataMd5[i]);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static byte[] ComputeMD5Hash(string data, Encoding encoding)
|
||||
private static byte[] ComputeMD5Hash(string data)
|
||||
{
|
||||
MD5 md5 = MD5.Create();
|
||||
return md5.ComputeHash(encoding.GetBytes(data));
|
||||
return md5.ComputeHash(Encoding.Default.GetBytes(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -507,12 +501,6 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public static string SHA1Hash(string data, Encoding enc)
|
||||
{
|
||||
return SHA1Hash(enc.GetBytes(data));
|
||||
}
|
||||
|
||||
public static string SHA1Hash(string data)
|
||||
{
|
||||
return SHA1Hash(Encoding.Default.GetBytes(data));
|
||||
@@ -862,6 +850,12 @@ namespace OpenSim.Framework
|
||||
return Math.Min(Math.Max(x, min), max);
|
||||
}
|
||||
|
||||
public static Vector3 Clip(Vector3 vec, float min, float max)
|
||||
{
|
||||
return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max),
|
||||
Clip(vec.Z, min, max));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
|
||||
/// </summary>
|
||||
@@ -1117,19 +1111,19 @@ namespace OpenSim.Framework
|
||||
{
|
||||
string os = String.Empty;
|
||||
|
||||
// if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
// {
|
||||
// os = Environment.OSVersion.ToString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// os = ReadEtcIssue();
|
||||
// }
|
||||
//
|
||||
// if (os.Length > 45)
|
||||
// {
|
||||
// os = os.Substring(0, 45);
|
||||
// }
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
{
|
||||
os = Environment.OSVersion.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
os = ReadEtcIssue();
|
||||
}
|
||||
|
||||
if (os.Length > 45)
|
||||
{
|
||||
os = os.Substring(0, 45);
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
@@ -1261,7 +1255,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public static Guid GetHashGuid(string data, string salt)
|
||||
{
|
||||
byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default);
|
||||
byte[] hash = ComputeMD5Hash(data + salt);
|
||||
|
||||
//string s = BitConverter.ToString(hash);
|
||||
|
||||
|
||||
@@ -223,7 +223,6 @@ namespace OpenSim.Framework
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = ex.Message;
|
||||
m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -303,7 +302,7 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public static OSDMap PostToService(string url, NameValueCollection data)
|
||||
{
|
||||
return ServiceFormRequest(url,data, 20000);
|
||||
return ServiceFormRequest(url,data,10000);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
|
||||
@@ -997,11 +996,6 @@ namespace OpenSim.Framework
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
|
||||
}
|
||||
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
@@ -1014,8 +1008,6 @@ namespace OpenSim.Framework
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
if (pTimeout != 0)
|
||||
request.Timeout = pTimeout * 1000;
|
||||
MemoryStream buffer = null;
|
||||
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
@@ -1131,4 +1123,4 @@ namespace OpenSim.Framework
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using NDesk.Options;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -310,8 +311,11 @@ namespace OpenSim
|
||||
"Change the scale of a named prim", HandleEditScale);
|
||||
|
||||
m_console.Commands.AddCommand("Users", false, "kick user",
|
||||
"kick user <first> <last> [message]",
|
||||
"Kick a user off the simulator", KickUserCommand);
|
||||
"kick user <first> <last> [--force] [message]",
|
||||
"Kick a user off the simulator",
|
||||
"The --force option will kick the user without any checks to see whether it's already in the process of closing\n"
|
||||
+ "Only use this option if you are sure the avatar is inactive and a normal kick user operation does not removed them",
|
||||
KickUserCommand);
|
||||
|
||||
m_console.Commands.AddCommand("Users", false, "show users",
|
||||
"show users [full]",
|
||||
@@ -416,6 +420,7 @@ namespace OpenSim
|
||||
{
|
||||
RunCommandScript(m_shutdownCommandsFile);
|
||||
}
|
||||
|
||||
base.ShutdownSpecific();
|
||||
}
|
||||
|
||||
@@ -453,11 +458,17 @@ namespace OpenSim
|
||||
/// <param name="cmdparams">name of avatar to kick</param>
|
||||
private void KickUserCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 4)
|
||||
bool force = false;
|
||||
|
||||
OptionSet options = new OptionSet().Add("f|force", delegate (string v) { force = v != null; });
|
||||
|
||||
List<string> mainParams = options.Parse(cmdparams);
|
||||
|
||||
if (mainParams.Count < 4)
|
||||
return;
|
||||
|
||||
string alert = null;
|
||||
if (cmdparams.Length > 4)
|
||||
if (mainParams.Count > 4)
|
||||
alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
|
||||
|
||||
IList agents = SceneManager.GetCurrentSceneAvatars();
|
||||
@@ -466,8 +477,8 @@ namespace OpenSim
|
||||
{
|
||||
RegionInfo regionInfo = presence.Scene.RegionInfo;
|
||||
|
||||
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
|
||||
presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
|
||||
if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) &&
|
||||
presence.Lastname.ToLower().Contains(mainParams[3].ToLower()))
|
||||
{
|
||||
MainConsole.Instance.Output(
|
||||
String.Format(
|
||||
@@ -478,9 +489,9 @@ namespace OpenSim
|
||||
if (alert != null)
|
||||
presence.ControllingClient.Kick(alert);
|
||||
else
|
||||
presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
|
||||
presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
|
||||
|
||||
presence.Scene.IncomingCloseAgent(presence.UUID);
|
||||
presence.Scene.IncomingCloseAgent(presence.UUID, force);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,10 +97,6 @@ namespace OpenSim
|
||||
|
||||
protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
|
||||
|
||||
private List<string> m_permsModules;
|
||||
|
||||
private bool m_securePermissionsLoading = true;
|
||||
|
||||
/// <value>
|
||||
/// The config information passed into the OpenSimulator region server.
|
||||
/// </value>
|
||||
@@ -205,11 +201,6 @@ namespace OpenSim
|
||||
CreatePIDFile(pidFile);
|
||||
|
||||
userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
|
||||
|
||||
m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true);
|
||||
|
||||
string permissionModules = startupConfig.GetString("permissionmodules", "DefaultPermissionsModule");
|
||||
m_permsModules = new List<string>(permissionModules.Split(','));
|
||||
}
|
||||
|
||||
// Load the simulation data service
|
||||
@@ -238,12 +229,6 @@ namespace OpenSim
|
||||
m_moduleLoader = new ModuleLoader(m_config.Source);
|
||||
|
||||
LoadPlugins();
|
||||
|
||||
if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
|
||||
{
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
foreach (IApplicationPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.PostInitialise();
|
||||
@@ -402,41 +387,7 @@ namespace OpenSim
|
||||
}
|
||||
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
|
||||
|
||||
if (m_securePermissionsLoading)
|
||||
{
|
||||
foreach (string s in m_permsModules)
|
||||
{
|
||||
if (!scene.RegionModules.ContainsKey(s))
|
||||
{
|
||||
bool found = false;
|
||||
foreach (IRegionModule m in modules)
|
||||
{
|
||||
if (m.Name == s)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
m_log.Fatal("[MODULES]: Required module " + s + " not found.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene.SetModuleInterfaces();
|
||||
// First Step of bootreport sequence
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.ColdStart(1,scene);
|
||||
scene.SnmpService.LinkDown(scene);
|
||||
}
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Loading prins", scene);
|
||||
}
|
||||
|
||||
while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
|
||||
SetUpEstateOwner(scene);
|
||||
@@ -450,11 +401,6 @@ namespace OpenSim
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Grid Registration in progress", scene);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
scene.RegisterRegionWithGrid();
|
||||
@@ -465,29 +411,15 @@ namespace OpenSim
|
||||
"[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.Critical("Grid registration failed. Startup aborted.", scene);
|
||||
}
|
||||
// Carrying on now causes a lot of confusion down the
|
||||
// line - we need to get the user's attention
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Grid Registration done", scene);
|
||||
}
|
||||
|
||||
// We need to do this after we've initialized the
|
||||
// scripting engines.
|
||||
scene.CreateScriptInstances();
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("ScriptEngine started", scene);
|
||||
}
|
||||
|
||||
SceneManager.Add(scene);
|
||||
|
||||
if (m_autoCreateClientStack)
|
||||
@@ -496,10 +428,6 @@ namespace OpenSim
|
||||
clientServer.Start();
|
||||
}
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Initializing region modules", scene);
|
||||
}
|
||||
if (do_post_init)
|
||||
{
|
||||
foreach (IRegionModule module in modules)
|
||||
@@ -511,12 +439,6 @@ namespace OpenSim
|
||||
|
||||
mscene = scene;
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("The region is operational", scene);
|
||||
scene.SnmpService.LinkUp(scene);
|
||||
}
|
||||
|
||||
scene.Start();
|
||||
scene.StartScripts();
|
||||
|
||||
@@ -635,11 +557,6 @@ namespace OpenSim
|
||||
private void ShutdownRegion(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName);
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("The region is shutting down", scene);
|
||||
scene.SnmpService.LinkDown(scene);
|
||||
}
|
||||
IRegionModulesController controller;
|
||||
if (ApplicationRegistry.TryGet<IRegionModulesController>(out controller))
|
||||
{
|
||||
|
||||
@@ -96,10 +96,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// private static readonly string m_fetchInventoryPath = "0006/";
|
||||
private static readonly string m_copyFromNotecardPath = "0007/";
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
private static readonly string m_getObjectPhysicsDataPath = "0101/";
|
||||
private static readonly string m_getObjectCostPath = "0102/";
|
||||
private static readonly string m_ResourceCostSelectedPath = "0103/";
|
||||
|
||||
|
||||
|
||||
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||
// receive capability calls
|
||||
@@ -207,14 +204,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
|
||||
IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData);
|
||||
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
|
||||
IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
|
||||
m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
|
||||
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
|
||||
m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
|
||||
|
||||
|
||||
|
||||
m_HostCapsObj.RegisterHandler(
|
||||
"CopyInventoryFromNotecard",
|
||||
@@ -865,151 +854,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
response["int_response_code"] = 200;
|
||||
return LLSDHelpers.SerialiseLLSDReply(response);
|
||||
}
|
||||
|
||||
public string GetObjectPhysicsData(string request, string path,
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
OSDArray object_ids = (OSDArray)req["object_ids"];
|
||||
|
||||
for (int i = 0 ; i < object_ids.Count ; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
|
||||
SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
|
||||
if (obj != null)
|
||||
{
|
||||
OSDMap object_data = new OSDMap();
|
||||
|
||||
object_data["PhysicsShapeType"] = obj.PhysicsShapeType;
|
||||
object_data["Density"] = obj.Density;
|
||||
object_data["Friction"] = obj.Friction;
|
||||
object_data["Restitution"] = obj.Bounciness;
|
||||
object_data["GravityMultiplier"] = obj.GravityModifier;
|
||||
|
||||
resp[uuid.ToString()] = object_data;
|
||||
}
|
||||
}
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
|
||||
public string GetObjectCost(string request, string path,
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
OSDArray object_ids = (OSDArray)req["object_ids"];
|
||||
|
||||
for (int i = 0; i < object_ids.Count; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
|
||||
|
||||
if (part != null)
|
||||
{
|
||||
SceneObjectGroup grp = part.ParentGroup;
|
||||
if (grp != null)
|
||||
{
|
||||
float linksetCost;
|
||||
float linksetPhysCost;
|
||||
float partCost;
|
||||
float partPhysCost;
|
||||
|
||||
grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost);
|
||||
|
||||
OSDMap object_data = new OSDMap();
|
||||
object_data["linked_set_resource_cost"] = linksetCost;
|
||||
object_data["resource_cost"] = partCost;
|
||||
object_data["physics_cost"] = partPhysCost;
|
||||
object_data["linked_set_physics_cost"] = linksetPhysCost;
|
||||
|
||||
resp[uuid.ToString()] = object_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
|
||||
public string ResourceCostSelected(string request, string path,
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
|
||||
float phys=0;
|
||||
float stream=0;
|
||||
float simul=0;
|
||||
|
||||
if (req.ContainsKey("selected_roots"))
|
||||
{
|
||||
OSDArray object_ids = (OSDArray)req["selected_roots"];
|
||||
|
||||
// should go by SOG suming costs for all parts
|
||||
// ll v3 works ok with several objects select we get the list and adds ok
|
||||
// FS calls per object so results are wrong guess fs bug
|
||||
for (int i = 0; i < object_ids.Count; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
float Physc;
|
||||
float simulc;
|
||||
float streamc;
|
||||
|
||||
SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid);
|
||||
if (grp != null)
|
||||
{
|
||||
grp.GetSelectedCosts(out Physc, out streamc, out simulc);
|
||||
phys += Physc;
|
||||
stream += streamc;
|
||||
simul += simulc;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (req.ContainsKey("selected_prims"))
|
||||
{
|
||||
OSDArray object_ids = (OSDArray)req["selected_prims"];
|
||||
|
||||
// don't see in use in any of the 2 viewers
|
||||
// guess it should be for edit linked but... nothing
|
||||
// should go to SOP per part
|
||||
for (int i = 0; i < object_ids.Count; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
|
||||
if (part != null)
|
||||
{
|
||||
phys += part.PhysicsCost;
|
||||
stream += part.StreamingCost;
|
||||
simul += part.SimulationCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (simul != 0)
|
||||
{
|
||||
OSDMap object_data = new OSDMap();
|
||||
|
||||
object_data["physics"] = phys;
|
||||
object_data["streaming"] = stream;
|
||||
object_data["simulation"] = simul;
|
||||
|
||||
resp["selected"] = object_data;
|
||||
}
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetUploader
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// TODO: Add EventQueueGet name/description for diagnostics
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(
|
||||
eventQueueGetPath,
|
||||
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 1000));
|
||||
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}",
|
||||
@@ -831,13 +831,5 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
return EventQueueHelper.BuildEvent(eventName, eventBody);
|
||||
}
|
||||
|
||||
public void partPhysicsProperties(uint localID, byte physhapetype,
|
||||
float density, float friction, float bounce, float gravmod,UUID avatarID)
|
||||
{
|
||||
OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype,
|
||||
density, friction, bounce, gravmod);
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,25 +395,5 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return message;
|
||||
}
|
||||
|
||||
public static OSD partPhysicsProperties(uint localID, byte physhapetype,
|
||||
float density, float friction, float bounce, float gravmod)
|
||||
{
|
||||
|
||||
OSDMap physinfo = new OSDMap(6);
|
||||
physinfo["LocalID"] = localID;
|
||||
physinfo["Density"] = density;
|
||||
physinfo["Friction"] = friction;
|
||||
physinfo["GravityMultiplier"] = gravmod;
|
||||
physinfo["Restitution"] = bounce;
|
||||
physinfo["PhysicsShapeType"] = (int)physhapetype;
|
||||
|
||||
OSDArray array = new OSDArray(1);
|
||||
array.Add(physinfo);
|
||||
|
||||
OSDMap llsdBody = new OSDMap(1);
|
||||
llsdBody.Add("ObjectData", array);
|
||||
|
||||
return BuildEvent("ObjectPhysicsProperties", llsdBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
|
||||
UUID spId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
SceneHelpers.AddScenePresence(m_scene, spId);
|
||||
m_scene.IncomingCloseAgent(spId);
|
||||
m_scene.IncomingCloseAgent(spId, false);
|
||||
|
||||
// TODO: Add more assertions for the other aspects of event queues
|
||||
Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
|
||||
|
||||
@@ -64,8 +64,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private Commands m_commands = new Commands();
|
||||
public ICommands Commands { get { return m_commands; } }
|
||||
|
||||
public event ConsoleMessage OnConsoleMessage;
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
m_commands.AddCommand( "Help", false, "help", "help [<item>]", "Display help on a particular command or on a list of commands in a category", Help);
|
||||
@@ -120,11 +118,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
OSD osd = OSD.FromString(message);
|
||||
|
||||
m_eventQueue.Enqueue(EventQueueHelper.BuildEvent("SimConsoleResponse", osd), agentID);
|
||||
|
||||
ConsoleMessage handlerConsoleMessage = OnConsoleMessage;
|
||||
|
||||
if (handlerConsoleMessage != null)
|
||||
handlerConsoleMessage( agentID, message);
|
||||
}
|
||||
|
||||
public bool RunCommand(string command, UUID invokerID)
|
||||
|
||||
@@ -27,15 +27,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
@@ -51,49 +48,67 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class WebFetchInvDescModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
|
||||
private bool m_Enabled;
|
||||
|
||||
private string m_fetchInventoryDescendents2Url;
|
||||
private string m_webFetchInventoryDescendentsUrl;
|
||||
|
||||
private WebFetchInvDescHandler m_webFetchHandler;
|
||||
|
||||
private ManualResetEvent m_ev = new ManualResetEvent(true);
|
||||
private object m_lock = new object();
|
||||
|
||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||
private Dictionary<UUID, Hashtable> m_requests = new Dictionary<UUID, Hashtable>();
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty);
|
||||
m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
|
||||
|
||||
if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty)
|
||||
{
|
||||
m_Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = s;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_InventoryService = m_scene.InventoryService;
|
||||
m_LibraryService = m_scene.LibraryService;
|
||||
|
||||
// We'll reuse the same handler for all requests.
|
||||
m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
|
||||
if (m_fetchInventoryDescendents2Url == "localhost" || m_webFetchInventoryDescendentsUrl == "localhost")
|
||||
m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -113,110 +128,41 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl = "/CAPS/" + UUID.Random() + "/";
|
||||
if (m_webFetchInventoryDescendentsUrl != "")
|
||||
RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl);
|
||||
|
||||
// Register this as a poll service
|
||||
PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000);
|
||||
args.Type = PollServiceEventArgs.EventType.Inventory;
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
|
||||
|
||||
string hostName = m_scene.RegionInfo.ExternalHostName;
|
||||
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
||||
string protocol = "http";
|
||||
|
||||
if (MainServer.Instance.UseSSL)
|
||||
{
|
||||
hostName = MainServer.Instance.SSLCommonName;
|
||||
port = MainServer.Instance.SSLPort;
|
||||
protocol = "https";
|
||||
}
|
||||
caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||
|
||||
m_capsDict[agentID] = capUrl;
|
||||
if (m_fetchInventoryDescendents2Url != "")
|
||||
RegisterFetchCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url);
|
||||
}
|
||||
|
||||
private void DeregisterCaps(UUID agentID, Caps caps)
|
||||
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
|
||||
{
|
||||
string capUrl;
|
||||
|
||||
if (m_capsDict.TryGetValue(agentID, out capUrl))
|
||||
if (url == "localhost")
|
||||
{
|
||||
MainServer.Instance.RemoveHTTPHandler("", capUrl);
|
||||
m_capsDict.Remove(agentID);
|
||||
capUrl = "/CAPS/" + UUID.Random();
|
||||
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler(
|
||||
"POST",
|
||||
capUrl,
|
||||
m_webFetchHandler.FetchInventoryDescendentsRequest,
|
||||
"FetchInventoryDescendents2",
|
||||
agentID.ToString());
|
||||
|
||||
caps.RegisterHandler(capName, reqHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public void HttpRequestHandler(UUID requestID, Hashtable request)
|
||||
{
|
||||
// m_log.DebugFormat("[FETCH2]: Received request {0}", requestID);
|
||||
m_requests[requestID] = request;
|
||||
}
|
||||
|
||||
private bool HasEvents(UUID requestID, UUID sessionID)
|
||||
{
|
||||
lock (m_lock)
|
||||
else
|
||||
{
|
||||
if (m_ev.WaitOne(0))
|
||||
{
|
||||
m_ev.Reset();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
capUrl = url;
|
||||
|
||||
private Hashtable NoEvents(UUID requestID, UUID sessionID)
|
||||
{
|
||||
m_requests.Remove(requestID);
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
|
||||
response["int_response_code"] = 500;
|
||||
response["str_response_string"] = "Script timeout";
|
||||
response["content_type"] = "text/plain";
|
||||
response["keepalive"] = false;
|
||||
response["reusecontext"] = false;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
|
||||
{
|
||||
Hashtable response = new Hashtable();
|
||||
|
||||
response["int_response_code"] = 500;
|
||||
response["str_response_string"] = "Internal error";
|
||||
response["content_type"] = "text/plain";
|
||||
response["keepalive"] = false;
|
||||
response["reusecontext"] = false;
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable requestHash;
|
||||
if (!m_requests.TryGetValue(requestID, out requestHash))
|
||||
{
|
||||
lock (m_lock)
|
||||
m_ev.Set();
|
||||
response["str_response_string"] = "Invalid request";
|
||||
return response;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID);
|
||||
|
||||
string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null);
|
||||
|
||||
m_requests.Remove(requestID);
|
||||
|
||||
response["int_response_code"] = 200;
|
||||
response["str_response_string"] = reply;
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (m_lock)
|
||||
m_ev.Set();
|
||||
caps.RegisterHandler(capName, capUrl);
|
||||
}
|
||||
|
||||
return response;
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}",
|
||||
// capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,9 +234,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_stopPacket = TexturePacketCount();
|
||||
}
|
||||
|
||||
//Give them at least two packets, to play nice with some broken viewers (SL also behaves this way)
|
||||
if (m_stopPacket == 1 && m_layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++;
|
||||
|
||||
m_currentPacket = StartPacket;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -158,7 +158,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC
|
||||
private int m_maxRTO = 60000;
|
||||
public bool m_deliverPackets = true;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
@@ -441,13 +440,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (category >= 0 && category < m_packetOutboxes.Length)
|
||||
{
|
||||
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
|
||||
|
||||
if (m_deliverPackets == false)
|
||||
{
|
||||
queue.Enqueue(packet);
|
||||
return true;
|
||||
}
|
||||
|
||||
TokenBucket bucket = m_throttleCategories[category];
|
||||
|
||||
// Don't send this packet if there is already a packet waiting in the queue
|
||||
@@ -497,9 +489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <returns>True if any packets were sent, otherwise false</returns>
|
||||
public bool DequeueOutgoing()
|
||||
{
|
||||
if (m_deliverPackets == false) return false;
|
||||
|
||||
OutgoingPacket packet = null;
|
||||
OutgoingPacket packet;
|
||||
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
|
||||
TokenBucket bucket;
|
||||
bool packetSent = false;
|
||||
@@ -531,49 +521,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// No dequeued packet waiting to be sent, try to pull one off
|
||||
// this queue
|
||||
queue = m_packetOutboxes[i];
|
||||
if (queue != null)
|
||||
if (queue.Dequeue(out packet))
|
||||
{
|
||||
bool success = false;
|
||||
try
|
||||
// A packet was pulled off the queue. See if we have
|
||||
// enough tokens in the bucket to send it out
|
||||
if (bucket.RemoveTokens(packet.Buffer.DataLength))
|
||||
{
|
||||
success = queue.Dequeue(out packet);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
// A packet was pulled off the queue. See if we have
|
||||
// enough tokens in the bucket to send it out
|
||||
if (bucket.RemoveTokens(packet.Buffer.DataLength))
|
||||
{
|
||||
// Send the packet
|
||||
m_udpServer.SendPacketFinal(packet);
|
||||
packetSent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save the dequeued packet for the next iteration
|
||||
m_nextPackets[i] = packet;
|
||||
}
|
||||
|
||||
// If the queue is empty after this dequeue, fire the queue
|
||||
// empty callback now so it has a chance to fill before we
|
||||
// get back here
|
||||
if (queue.Count == 0)
|
||||
emptyCategories |= CategoryToFlag(i);
|
||||
// Send the packet
|
||||
m_udpServer.SendPacketFinal(packet);
|
||||
packetSent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No packets in this queue. Fire the queue empty callback
|
||||
// if it has not been called recently
|
||||
emptyCategories |= CategoryToFlag(i);
|
||||
// Save the dequeued packet for the next iteration
|
||||
m_nextPackets[i] = packet;
|
||||
}
|
||||
|
||||
// If the queue is empty after this dequeue, fire the queue
|
||||
// empty callback now so it has a chance to fill before we
|
||||
// get back here
|
||||
if (queue.Count == 0)
|
||||
emptyCategories |= CategoryToFlag(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
|
||||
// No packets in this queue. Fire the queue empty callback
|
||||
// if it has not been called recently
|
||||
emptyCategories |= CategoryToFlag(i);
|
||||
}
|
||||
}
|
||||
@@ -731,4 +704,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,10 +110,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <summary>Handlers for incoming packets</summary>
|
||||
//PacketEventDictionary packetEvents = new PacketEventDictionary();
|
||||
/// <summary>Incoming packets that are awaiting handling</summary>
|
||||
//private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
|
||||
|
||||
private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>();
|
||||
|
||||
private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
|
||||
/// <summary></summary>
|
||||
//private UDPClientCollection m_clients = new UDPClientCollection();
|
||||
/// <summary>Bandwidth throttle for this UDP server</summary>
|
||||
@@ -158,8 +155,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <summary>Flag to signal when clients should send pings</summary>
|
||||
protected bool m_sendPing;
|
||||
|
||||
private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
|
||||
|
||||
private int m_defaultRTO = 0;
|
||||
private int m_maxRTO = 0;
|
||||
private int m_ackTimeout = 0;
|
||||
@@ -770,44 +765,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
#region Packet to Client Mapping
|
||||
|
||||
// If there is already a client for this endpoint, don't process UseCircuitCode
|
||||
IClientAPI client = null;
|
||||
if (!m_scene.TryGetClient(address, out client))
|
||||
// UseCircuitCode handling
|
||||
if (packet.Type == PacketType.UseCircuitCode)
|
||||
{
|
||||
// UseCircuitCode handling
|
||||
if (packet.Type == PacketType.UseCircuitCode)
|
||||
{
|
||||
// And if there is a UseCircuitCode pending, also drop it
|
||||
lock (m_pendingCache)
|
||||
{
|
||||
if (m_pendingCache.Contains(address))
|
||||
return;
|
||||
object[] array = new object[] { buffer, packet };
|
||||
|
||||
m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60);
|
||||
}
|
||||
Util.FireAndForget(HandleUseCircuitCode, array);
|
||||
|
||||
object[] array = new object[] { buffer, packet };
|
||||
|
||||
Util.FireAndForget(HandleUseCircuitCode, array);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a pending connection, enqueue, don't process yet
|
||||
lock (m_pendingCache)
|
||||
{
|
||||
Queue<UDPPacketBuffer> queue;
|
||||
if (m_pendingCache.TryGetValue(address, out queue))
|
||||
{
|
||||
//m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type);
|
||||
queue.Enqueue(buffer);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine which agent this packet came from
|
||||
if (client == null || !(client is LLClientView))
|
||||
IClientAPI client;
|
||||
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
||||
{
|
||||
//m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||
return;
|
||||
@@ -816,10 +786,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
udpClient = ((LLClientView)client).UDPClient;
|
||||
|
||||
if (!udpClient.IsConnected)
|
||||
{
|
||||
// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName);
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion Packet to Client Mapping
|
||||
|
||||
@@ -922,11 +889,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#endregion Ping Check Handling
|
||||
|
||||
// Inbox insertion
|
||||
if (packet.Type == PacketType.AgentUpdate ||
|
||||
packet.Type == PacketType.ChatFromViewer)
|
||||
packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet));
|
||||
else
|
||||
packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet));
|
||||
packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet));
|
||||
}
|
||||
|
||||
#region BinaryStats
|
||||
@@ -1048,32 +1011,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||
if (client != null)
|
||||
client.SceneAgent.SendInitialDataToMe();
|
||||
|
||||
// Now we know we can handle more data
|
||||
Thread.Sleep(200);
|
||||
|
||||
// Obtain the queue and remove it from the cache
|
||||
Queue<UDPPacketBuffer> queue = null;
|
||||
|
||||
lock (m_pendingCache)
|
||||
{
|
||||
if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue))
|
||||
{
|
||||
m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present");
|
||||
return;
|
||||
}
|
||||
m_pendingCache.Remove(remoteEndPoint);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count);
|
||||
|
||||
// Reinject queued packets
|
||||
while(queue.Count > 0)
|
||||
{
|
||||
UDPPacketBuffer buf = queue.Dequeue();
|
||||
PacketReceived(buf);
|
||||
}
|
||||
queue = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1081,8 +1018,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}",
|
||||
uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint);
|
||||
lock (m_pendingCache)
|
||||
m_pendingCache.Remove(remoteEndPoint);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
@@ -1201,7 +1136,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (!client.SceneAgent.IsChildAgent)
|
||||
client.Kick("Simulator logged you out due to connection timeout");
|
||||
|
||||
client.CloseWithoutChecks(true);
|
||||
client.CloseWithoutChecks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1213,7 +1148,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
while (base.IsRunning)
|
||||
{
|
||||
m_scene.ThreadAlive(1);
|
||||
try
|
||||
{
|
||||
IncomingPacket incomingPacket = null;
|
||||
@@ -1256,7 +1190,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
while (base.IsRunning)
|
||||
{
|
||||
m_scene.ThreadAlive(2);
|
||||
try
|
||||
{
|
||||
m_packetSent = false;
|
||||
@@ -1478,8 +1411,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
Packet packet = incomingPacket.Packet;
|
||||
LLClientView client = incomingPacket.Client;
|
||||
|
||||
// if (client.IsActive)
|
||||
// {
|
||||
if (client.IsActive)
|
||||
{
|
||||
m_currentIncomingClient = client;
|
||||
|
||||
try
|
||||
@@ -1506,13 +1439,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_currentIncomingClient = null;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
|
||||
// packet.Type, client.Name, m_scene.RegionInfo.RegionName);
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
|
||||
packet.Type, client.Name, m_scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
protected void LogoutHandler(IClientAPI client)
|
||||
@@ -1522,116 +1455,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (!client.IsLoggingOut)
|
||||
{
|
||||
client.IsLoggingOut = true;
|
||||
client.Close(false);
|
||||
client.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DoubleQueue<T> where T:class
|
||||
{
|
||||
private Queue<T> m_lowQueue = new Queue<T>();
|
||||
private Queue<T> m_highQueue = new Queue<T>();
|
||||
|
||||
private object m_syncRoot = new object();
|
||||
private Semaphore m_s = new Semaphore(0, 1);
|
||||
|
||||
public DoubleQueue()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual int Count
|
||||
{
|
||||
get { return m_highQueue.Count + m_lowQueue.Count; }
|
||||
}
|
||||
|
||||
public virtual void Enqueue(T data)
|
||||
{
|
||||
Enqueue(m_lowQueue, data);
|
||||
}
|
||||
|
||||
public virtual void EnqueueLow(T data)
|
||||
{
|
||||
Enqueue(m_lowQueue, data);
|
||||
}
|
||||
|
||||
public virtual void EnqueueHigh(T data)
|
||||
{
|
||||
Enqueue(m_highQueue, data);
|
||||
}
|
||||
|
||||
private void Enqueue(Queue<T> q, T data)
|
||||
{
|
||||
lock (m_syncRoot)
|
||||
{
|
||||
m_lowQueue.Enqueue(data);
|
||||
m_s.WaitOne(0);
|
||||
m_s.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T Dequeue()
|
||||
{
|
||||
return Dequeue(Timeout.Infinite);
|
||||
}
|
||||
|
||||
public virtual T Dequeue(int tmo)
|
||||
{
|
||||
return Dequeue(TimeSpan.FromMilliseconds(tmo));
|
||||
}
|
||||
|
||||
public virtual T Dequeue(TimeSpan wait)
|
||||
{
|
||||
T res = null;
|
||||
|
||||
if (!Dequeue(wait, ref res))
|
||||
return null;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public bool Dequeue(int timeout, ref T res)
|
||||
{
|
||||
return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
|
||||
}
|
||||
|
||||
public bool Dequeue(TimeSpan wait, ref T res)
|
||||
{
|
||||
if (!m_s.WaitOne(wait))
|
||||
return false;
|
||||
|
||||
lock (m_syncRoot)
|
||||
{
|
||||
if (m_highQueue.Count > 0)
|
||||
res = m_highQueue.Dequeue();
|
||||
else
|
||||
res = m_lowQueue.Dequeue();
|
||||
|
||||
if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
|
||||
return true;
|
||||
|
||||
try
|
||||
{
|
||||
m_s.Release();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Clear()
|
||||
{
|
||||
|
||||
lock (m_syncRoot)
|
||||
{
|
||||
// Make sure sem count is 0
|
||||
m_s.WaitOne(0);
|
||||
|
||||
m_lowQueue.Clear();
|
||||
m_highQueue.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,10 @@ namespace OpenMetaverse
|
||||
const int SIO_UDP_CONNRESET = -1744830452;
|
||||
|
||||
IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}",
|
||||
ipep.Address, ipep.Port);
|
||||
|
||||
m_udpSocket = new Socket(
|
||||
AddressFamily.InterNetwork,
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -39,13 +38,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
public class AssetXferUploader
|
||||
{
|
||||
// Viewer's notion of the default texture
|
||||
private List<UUID> defaultIDs = new List<UUID> {
|
||||
new UUID("5748decc-f629-461c-9a36-a35a221fe21f"),
|
||||
new UUID("7ca39b4c-bd19-4699-aff7-f93fd03d3e7b"),
|
||||
new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77"),
|
||||
new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97")
|
||||
};
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
@@ -73,7 +65,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
private UUID TransactionID = UUID.Zero;
|
||||
private sbyte type = 0;
|
||||
private byte wearableType = 0;
|
||||
private byte[] m_oldData = null;
|
||||
public ulong XferID;
|
||||
private Scene m_Scene;
|
||||
|
||||
@@ -311,7 +302,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
|
||||
private void DoCreateItem(uint callbackID)
|
||||
{
|
||||
ValidateAssets();
|
||||
m_Scene.AssetService.Store(m_asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
@@ -332,84 +322,12 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
item.Flags = (uint) wearableType;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
m_log.DebugFormat("[XFER]: Created item {0} with asset {1}",
|
||||
item.ID, item.AssetID);
|
||||
|
||||
if (m_Scene.AddInventoryItem(item))
|
||||
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
else
|
||||
ourClient.SendAlertMessage("Unable to create inventory item");
|
||||
}
|
||||
|
||||
private void ValidateAssets()
|
||||
{
|
||||
if (m_asset.Type == (sbyte)AssetType.Clothing ||
|
||||
m_asset.Type == (sbyte)AssetType.Bodypart)
|
||||
{
|
||||
string content = System.Text.Encoding.ASCII.GetString(m_asset.Data);
|
||||
string[] lines = content.Split(new char[] {'\n'});
|
||||
|
||||
List<string> validated = new List<string>();
|
||||
|
||||
Dictionary<int, UUID> allowed = ExtractTexturesFromOldData();
|
||||
|
||||
int textures = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (line.StartsWith("textures "))
|
||||
{
|
||||
textures = Convert.ToInt32(line.Substring(9));
|
||||
validated.Add(line);
|
||||
}
|
||||
else if (textures > 0)
|
||||
{
|
||||
string[] parts = line.Split(new char[] {' '});
|
||||
|
||||
UUID tx = new UUID(parts[1]);
|
||||
int id = Convert.ToInt32(parts[0]);
|
||||
|
||||
if (defaultIDs.Contains(tx) || tx == UUID.Zero ||
|
||||
(allowed.ContainsKey(id) && allowed[id] == tx))
|
||||
{
|
||||
validated.Add(parts[0] + " " + tx.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
int perms = m_Scene.InventoryService.GetAssetPermissions(ourClient.AgentId, tx);
|
||||
int full = (int)(PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Copy);
|
||||
|
||||
if ((perms & full) != full)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId);
|
||||
validated.Add(parts[0] + " " + UUID.Zero.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
validated.Add(line);
|
||||
}
|
||||
}
|
||||
textures--;
|
||||
}
|
||||
else
|
||||
{
|
||||
validated.Add(line);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If it's malformed, skip it
|
||||
}
|
||||
}
|
||||
|
||||
string final = String.Join("\n", validated.ToArray());
|
||||
|
||||
m_asset.Data = System.Text.Encoding.ASCII.GetBytes(final);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the asset data uploaded in this transfer.
|
||||
/// </summary>
|
||||
@@ -418,55 +336,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
if (m_finished)
|
||||
{
|
||||
ValidateAssets();
|
||||
return m_asset;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetOldData(byte[] d)
|
||||
{
|
||||
m_oldData = d;
|
||||
}
|
||||
|
||||
private Dictionary<int,UUID> ExtractTexturesFromOldData()
|
||||
{
|
||||
Dictionary<int,UUID> result = new Dictionary<int,UUID>();
|
||||
if (m_oldData == null)
|
||||
return result;
|
||||
|
||||
string content = System.Text.Encoding.ASCII.GetString(m_oldData);
|
||||
string[] lines = content.Split(new char[] {'\n'});
|
||||
|
||||
int textures = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (line.StartsWith("textures "))
|
||||
{
|
||||
textures = Convert.ToInt32(line.Substring(9));
|
||||
}
|
||||
else if (textures > 0)
|
||||
{
|
||||
string[] parts = line.Split(new char[] {' '});
|
||||
|
||||
UUID tx = new UUID(parts[1]);
|
||||
int id = Convert.ToInt32(parts[0]);
|
||||
result[id] = tx;
|
||||
textures--;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If it's malformed, skip it
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,8 +145,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||
{
|
||||
byte[] fileData = NewFiles[fileName].Data;
|
||||
XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
|
||||
if (fileName.StartsWith("inventory_"))
|
||||
transaction.isTaskInventory = true;
|
||||
|
||||
Transfers.Add(xferID, transaction);
|
||||
|
||||
@@ -230,7 +228,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||
public uint Packet = 0;
|
||||
public uint Serial = 1;
|
||||
public ulong XferID = 0;
|
||||
public bool isTaskInventory = false;
|
||||
|
||||
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
|
||||
{
|
||||
@@ -256,7 +253,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||
byte[] transferData = new byte[Data.Length + 4];
|
||||
Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||
Array.Copy(Data, 0, transferData, 4, Data.Length);
|
||||
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData, isTaskInventory);
|
||||
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
|
||||
complete = true;
|
||||
}
|
||||
else
|
||||
@@ -264,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||
byte[] transferData = new byte[1000 + 4];
|
||||
Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||
Array.Copy(Data, 0, transferData, 4, 1000);
|
||||
Client.SendXferPacket(XferID, 0, transferData, isTaskInventory);
|
||||
Client.SendXferPacket(XferID, 0, transferData);
|
||||
Packet++;
|
||||
DataPointer = 1000;
|
||||
}
|
||||
@@ -285,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||
{
|
||||
byte[] transferData = new byte[1000];
|
||||
Array.Copy(Data, DataPointer, transferData, 0, 1000);
|
||||
Client.SendXferPacket(XferID, Packet, transferData, isTaskInventory);
|
||||
Client.SendXferPacket(XferID, Packet, transferData);
|
||||
Packet++;
|
||||
DataPointer += 1000;
|
||||
}
|
||||
@@ -294,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||
byte[] transferData = new byte[Data.Length - DataPointer];
|
||||
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
|
||||
uint endPacket = Packet |= (uint) 0x80000000;
|
||||
Client.SendXferPacket(XferID, endPacket, transferData, isTaskInventory);
|
||||
Client.SendXferPacket(XferID, endPacket, transferData);
|
||||
Packet++;
|
||||
DataPointer += (Data.Length - DataPointer);
|
||||
|
||||
|
||||
@@ -257,71 +257,58 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
|
||||
private void UpdateFileCache(string key, AssetBase asset)
|
||||
{
|
||||
// TODO: Spawn this off to some seperate thread to do the actual writing
|
||||
if (asset != null)
|
||||
string filename = GetFileName(asset.ID);
|
||||
|
||||
try
|
||||
{
|
||||
string filename = GetFileName(key);
|
||||
|
||||
try
|
||||
// If the file is already cached just update access time.
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
// If the file is already cached, don't cache it, just touch it so access time is updated
|
||||
if (File.Exists(filename))
|
||||
lock (m_CurrentlyWriting)
|
||||
{
|
||||
// We don't really want to know about sharing
|
||||
// violations here. If the file is locked, then
|
||||
// the other thread has updated the time for us.
|
||||
try
|
||||
{
|
||||
lock (m_CurrentlyWriting)
|
||||
{
|
||||
if (!m_CurrentlyWriting.Contains(filename))
|
||||
File.SetLastAccessTime(filename, DateTime.Now);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
} else {
|
||||
|
||||
// Once we start writing, make sure we flag that we're writing
|
||||
// that object to the cache so that we don't try to write the
|
||||
// same file multiple times.
|
||||
lock (m_CurrentlyWriting)
|
||||
{
|
||||
#if WAIT_ON_INPROGRESS_REQUESTS
|
||||
if (m_CurrentlyWriting.ContainsKey(filename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
|
||||
}
|
||||
|
||||
#else
|
||||
if (m_CurrentlyWriting.Contains(filename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentlyWriting.Add(filename);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Util.FireAndForget(
|
||||
delegate { WriteFileCache(filename, asset); });
|
||||
if (!m_CurrentlyWriting.Contains(filename))
|
||||
File.SetLastAccessTime(filename, DateTime.Now);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
|
||||
asset.ID, e.Message, e.StackTrace);
|
||||
// Once we start writing, make sure we flag that we're writing
|
||||
// that object to the cache so that we don't try to write the
|
||||
// same file multiple times.
|
||||
lock (m_CurrentlyWriting)
|
||||
{
|
||||
#if WAIT_ON_INPROGRESS_REQUESTS
|
||||
if (m_CurrentlyWriting.ContainsKey(filename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
|
||||
}
|
||||
|
||||
#else
|
||||
if (m_CurrentlyWriting.Contains(filename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentlyWriting.Add(filename);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Util.FireAndForget(
|
||||
delegate { WriteFileCache(filename, asset); });
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
|
||||
asset.ID, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
public void Cache(AssetBase asset)
|
||||
|
||||
@@ -40,7 +40,6 @@ using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
{
|
||||
@@ -170,40 +169,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name);
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string stateData = String.Empty;
|
||||
|
||||
IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>();
|
||||
if (attServ != null)
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service");
|
||||
stateData = attServ.Get(sp.UUID.ToString());
|
||||
if (stateData != String.Empty)
|
||||
{
|
||||
try
|
||||
{
|
||||
doc.LoadXml(stateData);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<UUID, string> itemData = new Dictionary<UUID, string>();
|
||||
|
||||
XmlNodeList nodes = doc.GetElementsByTagName("Attachment");
|
||||
if (nodes.Count > 0)
|
||||
{
|
||||
foreach (XmlNode n in nodes)
|
||||
{
|
||||
XmlElement elem = (XmlElement)n;
|
||||
string itemID = elem.GetAttribute("ItemID");
|
||||
string xml = elem.InnerXml;
|
||||
|
||||
itemData[new UUID(itemID)] = xml;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<AvatarAttachment> attachments = sp.Appearance.GetAttachments();
|
||||
foreach (AvatarAttachment attach in attachments)
|
||||
{
|
||||
@@ -223,22 +188,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
try
|
||||
{
|
||||
string xmlData;
|
||||
XmlDocument d = null;
|
||||
UUID asset;
|
||||
if (itemData.TryGetValue(attach.ItemID, out xmlData))
|
||||
{
|
||||
d = new XmlDocument();
|
||||
d.LoadXml(xmlData);
|
||||
m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID);
|
||||
}
|
||||
|
||||
// If we're an NPC then skip all the item checks and manipulations since we don't have an
|
||||
// inventory right now.
|
||||
if (sp.PresenceType == PresenceType.Npc)
|
||||
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null);
|
||||
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p);
|
||||
else
|
||||
RezSingleAttachmentFromInventory(sp, attach.ItemID, p, d);
|
||||
RezSingleAttachmentFromInventory(sp, attach.ItemID, p);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -284,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
sp.ClearAttachments();
|
||||
}
|
||||
|
||||
public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp)
|
||||
public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp)
|
||||
{
|
||||
lock (sp.AttachmentsSyncLock)
|
||||
{
|
||||
@@ -339,24 +294,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
if (useAttachData)
|
||||
{
|
||||
group.RootPart.RotationOffset = group.RootPart.AttachRotation;
|
||||
attachPos = group.RootPart.AttachOffset;
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
attachmentPt = group.RootPart.AttachPoint;
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
attachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
else if (group.RootPart.AttachPoint != attachmentPt)
|
||||
{
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
group.AttachmentPoint = attachmentPt;
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
@@ -397,12 +334,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
}
|
||||
}
|
||||
|
||||
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
|
||||
{
|
||||
return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, null);
|
||||
}
|
||||
|
||||
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, XmlDocument doc)
|
||||
public SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
|
||||
{
|
||||
if (!Enabled)
|
||||
return null;
|
||||
@@ -441,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
return null;
|
||||
}
|
||||
|
||||
return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
|
||||
return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt);
|
||||
}
|
||||
|
||||
public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
|
||||
@@ -506,7 +438,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
so.AttachedAvatar = UUID.Zero;
|
||||
rootPart.SetParentLocalId(0);
|
||||
so.ClearPartAttachmentData();
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false);
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive);
|
||||
so.HasGroupChanged = true;
|
||||
rootPart.Rezzed = DateTime.Now;
|
||||
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
@@ -823,8 +755,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
UpdateDetachedObject(sp, so);
|
||||
}
|
||||
|
||||
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
||||
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc)
|
||||
private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
||||
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt)
|
||||
{
|
||||
if (m_invAccessModule == null)
|
||||
return null;
|
||||
@@ -862,7 +794,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
// This will throw if the attachment fails
|
||||
try
|
||||
{
|
||||
AttachObject(sp, objatt, attachmentPt, false, false, false);
|
||||
AttachObject(sp, objatt, attachmentPt, false, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -875,16 +807,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
m_scene.DeleteSceneObject(objatt, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (tainted)
|
||||
objatt.HasGroupChanged = true;
|
||||
|
||||
if (doc != null)
|
||||
{
|
||||
objatt.LoadScriptState(doc);
|
||||
objatt.ResetOwnerChangeFlag();
|
||||
}
|
||||
|
||||
// Fire after attach, so we don't get messy perms dialogs
|
||||
// 4 == AttachedRez
|
||||
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
|
||||
@@ -902,7 +828,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
itemID, sp.Name, attachmentPt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1022,7 +948,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, false))
|
||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false))
|
||||
{
|
||||
// m_log.Debug(
|
||||
// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
||||
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(sp.HasAttachments(), Is.True);
|
||||
@@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
sp2.AbsolutePosition = new Vector3(0, 0, 0);
|
||||
sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero);
|
||||
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false);
|
||||
|
||||
Assert.That(sp.HasAttachments(), Is.False);
|
||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||
@@ -410,7 +410,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
scene.EventManager.OnChatFromWorld += OnChatFromWorld;
|
||||
|
||||
SceneObjectGroup rezzedSo
|
||||
= (SceneObjectGroup)(scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest));
|
||||
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest);
|
||||
|
||||
// Wait for chat to signal rezzed script has been started.
|
||||
m_chatEvent.WaitOne(60000);
|
||||
@@ -429,7 +429,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
Assert.That(scriptStateNodes.Count, Is.EqualTo(1));
|
||||
|
||||
// Re-rez the attachment to check script running state
|
||||
SceneObjectGroup reRezzedSo = (SceneObjectGroup)(scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest));
|
||||
SceneObjectGroup reRezzedSo = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest);
|
||||
|
||||
// Wait for chat to signal rezzed script has been started.
|
||||
m_chatEvent.WaitOne(60000);
|
||||
@@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
|
||||
SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
|
||||
|
||||
scene.IncomingCloseAgent(presence.UUID);
|
||||
scene.IncomingCloseAgent(presence.UUID, false);
|
||||
|
||||
// Check that we can't retrieve this attachment from the scene.
|
||||
Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
|
||||
|
||||
@@ -566,17 +566,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
/// <param name="client"></param>
|
||||
private void Client_OnRequestWearables(IClientAPI client)
|
||||
{
|
||||
Util.FireAndForget(delegate(object x)
|
||||
{
|
||||
Thread.Sleep(4000);
|
||||
|
||||
// m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId);
|
||||
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
||||
if (sp != null)
|
||||
client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
|
||||
else
|
||||
m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
|
||||
});
|
||||
// m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId);
|
||||
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
||||
if (sp != null)
|
||||
client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
|
||||
else
|
||||
m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -49,8 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
private int m_shoutdistance = 100;
|
||||
private int m_whisperdistance = 10;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
private List<string> FreezeCache = new List<string>();
|
||||
private string m_adminPrefix = "";
|
||||
|
||||
internal object m_syncy = new object();
|
||||
|
||||
internal IConfig m_config;
|
||||
@@ -77,7 +76,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
|
||||
m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
|
||||
m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
|
||||
m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", "");
|
||||
}
|
||||
|
||||
public virtual void AddRegion(Scene scene)
|
||||
@@ -173,15 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
if (FreezeCache.Contains(c.Sender.AgentId.ToString()))
|
||||
{
|
||||
if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping)
|
||||
c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeliverChatToAvatars(ChatSourceType.Agent, c);
|
||||
}
|
||||
DeliverChatToAvatars(ChatSourceType.Agent, c);
|
||||
}
|
||||
|
||||
public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
|
||||
@@ -195,11 +185,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
|
||||
{
|
||||
string fromName = c.From;
|
||||
string fromNamePrefix = "";
|
||||
UUID fromID = UUID.Zero;
|
||||
UUID targetID = c.TargetUUID;
|
||||
string message = c.Message;
|
||||
IScene scene = c.Scene;
|
||||
UUID destination = c.Destination;
|
||||
Vector3 fromPos = c.Position;
|
||||
Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
|
||||
scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
|
||||
@@ -219,11 +208,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
fromPos = avatar.AbsolutePosition;
|
||||
fromName = avatar.Name;
|
||||
fromID = c.Sender.AgentId;
|
||||
if (avatar.GodLevel >= 200)
|
||||
{
|
||||
fromNamePrefix = m_adminPrefix;
|
||||
}
|
||||
destination = UUID.Zero; // Avatars cant "SayTo"
|
||||
|
||||
break;
|
||||
|
||||
case ChatSourceType.Object:
|
||||
@@ -237,39 +222,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
message = message.Substring(0, 1000);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
|
||||
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
|
||||
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}",
|
||||
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID);
|
||||
|
||||
HashSet<UUID> receiverIDs = new HashSet<UUID>();
|
||||
|
||||
|
||||
foreach (Scene s in m_scenes)
|
||||
{
|
||||
// This should use ForEachClient, but clients don't have a position.
|
||||
// If camera is moved into client, then camera position can be used
|
||||
// MT: No, it can't, as chat is heard from the avatar position, not
|
||||
// the camera position.
|
||||
s.ForEachRootScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
if (destination != UUID.Zero && presence.UUID != destination)
|
||||
return;
|
||||
ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
|
||||
if (Presencecheck != null)
|
||||
if (targetID == UUID.Zero)
|
||||
{
|
||||
// This should use ForEachClient, but clients don't have a position.
|
||||
// If camera is moved into client, then camera position can be used
|
||||
s.ForEachRootScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
// This will pass all chat from objects. Not
|
||||
// perfect, but it will do. For now. Better
|
||||
// than the prior behavior of muting all
|
||||
// objects on a parcel with access restrictions
|
||||
if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
|
||||
{
|
||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType))
|
||||
receiverIDs.Add(presence.UUID);
|
||||
}
|
||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false))
|
||||
receiverIDs.Add(presence.UUID);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a send to a specific client eg from llRegionSayTo
|
||||
// no need to check distance etc, jand send is as say
|
||||
ScenePresence presence = s.GetScenePresence(targetID);
|
||||
if (presence != null && !presence.IsChildAgent)
|
||||
{
|
||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true))
|
||||
receiverIDs.Add(presence.UUID);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(scene as Scene).EventManager.TriggerOnChatToClients(
|
||||
fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
|
||||
}
|
||||
@@ -309,29 +293,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
|
||||
|
||||
HashSet<UUID> receiverIDs = new HashSet<UUID>();
|
||||
|
||||
if (c.Scene != null)
|
||||
{
|
||||
((Scene)c.Scene).ForEachRootClient
|
||||
(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
|
||||
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
|
||||
receiverIDs.Add(client.AgentId);
|
||||
}
|
||||
);
|
||||
(c.Scene as Scene).EventManager.TriggerOnChatToClients(
|
||||
fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
|
||||
}
|
||||
((Scene)c.Scene).ForEachRootClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
|
||||
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
|
||||
receiverIDs.Add(client.AgentId);
|
||||
});
|
||||
|
||||
(c.Scene as Scene).EventManager.TriggerOnChatToClients(
|
||||
fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -349,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
/// precondition</returns>
|
||||
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
|
||||
UUID fromAgentID, string fromName, ChatTypeEnum type,
|
||||
string message, ChatSourceType src)
|
||||
string message, ChatSourceType src, bool ignoreDistance)
|
||||
{
|
||||
// don't send chat to child agents
|
||||
// don't send stuff to child agents
|
||||
if (presence.IsChildAgent) return false;
|
||||
|
||||
Vector3 fromRegionPos = fromPos + regionPos;
|
||||
@@ -360,12 +341,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
|
||||
|
||||
int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
|
||||
|
||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||
|
||||
if (!ignoreDistance)
|
||||
{
|
||||
return false;
|
||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
@@ -374,35 +358,5 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
|
||||
public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
|
||||
{
|
||||
System.Threading.Timer Timer;
|
||||
if (flags == 0)
|
||||
{
|
||||
FreezeCache.Add(target.ToString());
|
||||
System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
|
||||
Timer = new System.Threading.Timer(timeCB, target, 30000, 0);
|
||||
Timers.Add(target, Timer);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreezeCache.Remove(target.ToString());
|
||||
Timers.TryGetValue(target, out Timer);
|
||||
Timers.Remove(target);
|
||||
Timer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEndParcelFrozen(object avatar)
|
||||
{
|
||||
UUID target = (UUID)avatar;
|
||||
FreezeCache.Remove(target.ToString());
|
||||
System.Threading.Timer Timer;
|
||||
Timers.TryGetValue(target, out Timer);
|
||||
Timers.Remove(target);
|
||||
Timer.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,4 +216,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,40 +31,16 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
{
|
||||
public class GodsModule : IRegionModule, IGodsModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>Special UUID for actions that apply to all agents</summary>
|
||||
private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
|
||||
|
||||
protected Scene m_scene;
|
||||
protected IDialogModule m_dialogModule;
|
||||
|
||||
protected Dictionary<UUID, string> m_capsDict =
|
||||
new Dictionary<UUID, string>();
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
@@ -72,10 +48,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
|
||||
m_scene.RegisterModuleInterface<IGodsModule>(this);
|
||||
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
|
||||
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||
m_scene.EventManager.OnClientClosed += OnClientClosed;
|
||||
scene.EventManager.OnIncomingInstantMessage +=
|
||||
OnIncomingInstantMessage;
|
||||
}
|
||||
|
||||
public void PostInitialise() {}
|
||||
@@ -95,54 +67,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
client.OnRequestGodlikePowers -= RequestGodlikePowers;
|
||||
}
|
||||
|
||||
private void OnClientClosed(UUID agentID, Scene scene)
|
||||
{
|
||||
m_capsDict.Remove(agentID);
|
||||
}
|
||||
|
||||
private void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string uri = "/CAPS/" + UUID.Random();
|
||||
m_capsDict[agentID] = uri;
|
||||
|
||||
caps.RegisterHandler("UntrustedSimulatorMessage",
|
||||
new RestStreamHandler("POST", uri,
|
||||
HandleUntrustedSimulatorMessage));
|
||||
}
|
||||
|
||||
private string HandleUntrustedSimulatorMessage(string request,
|
||||
string path, string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
|
||||
string message = osd["message"].AsString();
|
||||
|
||||
if (message == "GodKickUser")
|
||||
{
|
||||
OSDMap body = (OSDMap)osd["body"];
|
||||
OSDArray userInfo = (OSDArray)body["UserInfo"];
|
||||
OSDMap userData = (OSDMap)userInfo[0];
|
||||
|
||||
UUID agentID = userData["AgentID"].AsUUID();
|
||||
UUID godID = userData["GodID"].AsUUID();
|
||||
UUID godSessionID = userData["GodSessionID"].AsUUID();
|
||||
uint kickFlags = userData["KickFlags"].AsUInteger();
|
||||
string reason = userData["Reason"].AsString();
|
||||
|
||||
ScenePresence god = m_scene.GetScenePresence(godID);
|
||||
if (god == null || god.ControllingClient.SessionId != godSessionID)
|
||||
return String.Empty;
|
||||
|
||||
KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[GOD]: Unhandled UntrustedSimulatorMessage: {0}", message);
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
public void RequestGodlikePowers(
|
||||
UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
|
||||
{
|
||||
@@ -191,85 +115,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
|
||||
public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason)
|
||||
{
|
||||
if (!m_scene.Permissions.IsGod(godID))
|
||||
return;
|
||||
|
||||
UUID kickUserID = ALL_AGENTS;
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
|
||||
if (sp == null && agentID != ALL_AGENTS)
|
||||
if (sp != null || agentID == kickUserID)
|
||||
{
|
||||
IMessageTransferModule transferModule =
|
||||
m_scene.RequestModuleInterface<IMessageTransferModule>();
|
||||
if (transferModule != null)
|
||||
if (m_scene.Permissions.IsGod(godID))
|
||||
{
|
||||
m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
|
||||
transferModule.SendInstantMessage(new GridInstantMessage(
|
||||
m_scene, godID, "God", agentID, (byte)250, false,
|
||||
Utils.BytesToString(reason), UUID.Zero, true,
|
||||
new Vector3(), new byte[] {(byte)kickflags}),
|
||||
delegate(bool success) {} );
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (kickflags == 0)
|
||||
{
|
||||
if (agentID == kickUserID)
|
||||
{
|
||||
string reasonStr = Utils.BytesToString(reason);
|
||||
|
||||
switch (kickflags)
|
||||
{
|
||||
case 0:
|
||||
if (sp != null)
|
||||
{
|
||||
KickPresence(sp, Utils.BytesToString(reason));
|
||||
}
|
||||
else if (agentID == ALL_AGENTS)
|
||||
{
|
||||
m_scene.ForEachRootScenePresence(
|
||||
delegate(ScenePresence p)
|
||||
{
|
||||
if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))
|
||||
KickPresence(p, Utils.BytesToString(reason));
|
||||
}
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sp != null)
|
||||
{
|
||||
sp.AllowMovement = false;
|
||||
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(godID, "User Frozen");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sp != null)
|
||||
{
|
||||
sp.AllowMovement = true;
|
||||
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_scene.ForEachClient(
|
||||
delegate(IClientAPI controller)
|
||||
{
|
||||
if (controller.AgentId != godID)
|
||||
controller.Kick(reasonStr);
|
||||
}
|
||||
);
|
||||
|
||||
private void KickPresence(ScenePresence sp, string reason)
|
||||
{
|
||||
if (sp.IsChildAgent)
|
||||
return;
|
||||
sp.ControllingClient.Kick(reason);
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
}
|
||||
// This is a bit crude. It seems the client will be null before it actually stops the thread
|
||||
// The thread will kill itself eventually :/
|
||||
// Is there another way to make sure *all* clients get this 'inter region' message?
|
||||
m_scene.ForEachRootClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
if (client.AgentId != godID)
|
||||
{
|
||||
client.Close();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent);
|
||||
|
||||
private void OnIncomingInstantMessage(GridInstantMessage msg)
|
||||
{
|
||||
if (msg.dialog == (uint)250) // Nonlocal kick
|
||||
{
|
||||
UUID agentID = new UUID(msg.toAgentID);
|
||||
string reason = msg.message;
|
||||
UUID godID = new UUID(msg.fromAgentID);
|
||||
uint kickMode = (uint)msg.binaryBucket[0];
|
||||
|
||||
KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason));
|
||||
sp.ControllingClient.Kick(Utils.BytesToString(reason));
|
||||
sp.ControllingClient.Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (kickflags == 1)
|
||||
{
|
||||
sp.AllowMovement = false;
|
||||
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(godID, "User Frozen");
|
||||
}
|
||||
|
||||
if (kickflags == 2)
|
||||
{
|
||||
sp.AllowMovement = true;
|
||||
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialogModule.SendAlertToUser(godID, "Kick request denied");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
@@ -43,10 +42,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Timer m_logTimer = new Timer(10000);
|
||||
private List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
|
||||
private string m_restUrl;
|
||||
|
||||
/// <value>
|
||||
/// Is this module enabled?
|
||||
/// </value>
|
||||
@@ -66,12 +61,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
"InstantMessageModule", "InstantMessageModule") !=
|
||||
"InstantMessageModule")
|
||||
return;
|
||||
m_restUrl = config.Configs["Messaging"].GetString("LogURL", String.Empty);
|
||||
}
|
||||
|
||||
m_enabled = true;
|
||||
m_logTimer.AutoReset = false;
|
||||
m_logTimer.Elapsed += LogTimerElapsed;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
@@ -156,9 +148,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
byte dialog = im.dialog;
|
||||
|
||||
if (client != null && dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
LogInstantMesssage(im);
|
||||
|
||||
if (dialog != (byte)InstantMessageDialog.MessageFromAgent
|
||||
&& dialog != (byte)InstantMessageDialog.StartTyping
|
||||
&& dialog != (byte)InstantMessageDialog.StopTyping
|
||||
@@ -168,32 +157,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
return;
|
||||
}
|
||||
|
||||
//DateTime dt = DateTime.UtcNow;
|
||||
|
||||
// Ticks from UtcNow, but make it look like local. Evil, huh?
|
||||
//dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
|
||||
|
||||
//try
|
||||
//{
|
||||
// // Convert that to the PST timezone
|
||||
// TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
|
||||
// dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// //m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp.");
|
||||
//}
|
||||
|
||||
//// And make it look local again to fool the unix time util
|
||||
//dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
|
||||
|
||||
// If client is null, this message comes from storage and IS offline
|
||||
if (client != null)
|
||||
im.offline = 0;
|
||||
|
||||
if (im.offline == 0)
|
||||
im.timestamp = (uint)Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (m_TransferModule != null)
|
||||
{
|
||||
if (client != null)
|
||||
@@ -237,35 +200,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
//
|
||||
OnInstantMessage(null, msg);
|
||||
}
|
||||
|
||||
private void LogInstantMesssage(GridInstantMessage im)
|
||||
{
|
||||
if (m_logData.Count < 20)
|
||||
{
|
||||
// Restart the log write timer
|
||||
m_logTimer.Stop();
|
||||
}
|
||||
if (!m_logTimer.Enabled)
|
||||
m_logTimer.Start();
|
||||
|
||||
lock (m_logData)
|
||||
{
|
||||
m_logData.Add(im);
|
||||
}
|
||||
}
|
||||
|
||||
private void LogTimerElapsed(object source, ElapsedEventArgs e)
|
||||
{
|
||||
lock (m_logData)
|
||||
{
|
||||
if (m_restUrl != String.Empty && m_logData.Count > 0)
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<List<GridInstantMessage>, bool>("POST", m_restUrl + "/LogMessages/", m_logData);
|
||||
if (!success)
|
||||
m_log.ErrorFormat("[INSTANT MESSAGE]: Failed to save log data");
|
||||
}
|
||||
m_logData.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private bool m_Enabled = false;
|
||||
protected string m_MessageKey = String.Empty;
|
||||
protected List<Scene> m_Scenes = new List<Scene>();
|
||||
protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
|
||||
|
||||
@@ -68,17 +67,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
public virtual void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig cnf = config.Configs["Messaging"];
|
||||
if (cnf != null)
|
||||
if (cnf != null && cnf.GetString(
|
||||
"MessageTransferModule", "MessageTransferModule") !=
|
||||
"MessageTransferModule")
|
||||
{
|
||||
if (cnf.GetString("MessageTransferModule",
|
||||
"MessageTransferModule") != "MessageTransferModule")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_MessageKey = cnf.GetString("MessageKey", String.Empty);
|
||||
m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration");
|
||||
return;
|
||||
}
|
||||
m_log.Debug("[MESSAGE TRANSFER]: Module enabled");
|
||||
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
@@ -251,19 +247,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
&& requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id")
|
||||
&& requestData.ContainsKey("binary_bucket"))
|
||||
{
|
||||
if (m_MessageKey != String.Empty)
|
||||
{
|
||||
XmlRpcResponse error_resp = new XmlRpcResponse();
|
||||
Hashtable error_respdata = new Hashtable();
|
||||
error_respdata["success"] = "FALSE";
|
||||
error_resp.Value = error_respdata;
|
||||
|
||||
if (!requestData.Contains("message_key"))
|
||||
return error_resp;
|
||||
if (m_MessageKey != (string)requestData["message_key"])
|
||||
return error_resp;
|
||||
}
|
||||
|
||||
// Do the easy way of validating the UUIDs
|
||||
UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID);
|
||||
UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
|
||||
@@ -440,37 +423,24 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
return resp;
|
||||
}
|
||||
|
||||
private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result);
|
||||
/// <summary>
|
||||
/// delegate for sending a grid instant message asynchronously
|
||||
/// </summary>
|
||||
public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID);
|
||||
|
||||
private class GIM {
|
||||
public GridInstantMessage im;
|
||||
public MessageResultNotification result;
|
||||
};
|
||||
|
||||
private Queue<GIM> pendingInstantMessages = new Queue<GIM>();
|
||||
private int numInstantMessageThreads = 0;
|
||||
|
||||
private void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result)
|
||||
protected virtual void GridInstantMessageCompleted(IAsyncResult iar)
|
||||
{
|
||||
lock (pendingInstantMessages) {
|
||||
if (numInstantMessageThreads >= 4) {
|
||||
GIM gim = new GIM();
|
||||
gim.im = im;
|
||||
gim.result = result;
|
||||
pendingInstantMessages.Enqueue(gim);
|
||||
} else {
|
||||
++ numInstantMessageThreads;
|
||||
//m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads);
|
||||
GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsyncMain;
|
||||
d.BeginInvoke(im, result, GridInstantMessageCompleted, d);
|
||||
}
|
||||
}
|
||||
GridInstantMessageDelegate icon =
|
||||
(GridInstantMessageDelegate)iar.AsyncState;
|
||||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
private void GridInstantMessageCompleted(IAsyncResult iar)
|
||||
|
||||
protected virtual void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result)
|
||||
{
|
||||
GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState;
|
||||
d.EndInvoke(iar);
|
||||
GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync;
|
||||
|
||||
d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -485,31 +455,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
/// Pass in 0 the first time this method is called. It will be called recursively with the last
|
||||
/// regionhandle tried
|
||||
/// </param>
|
||||
private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result)
|
||||
protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID)
|
||||
{
|
||||
GIM gim;
|
||||
do {
|
||||
try {
|
||||
SendGridInstantMessageViaXMLRPCAsync(im, result, UUID.Zero);
|
||||
} catch (Exception e) {
|
||||
m_log.Error("[SendGridInstantMessageViaXMLRPC]: exception " + e.Message);
|
||||
}
|
||||
lock (pendingInstantMessages) {
|
||||
if (pendingInstantMessages.Count > 0) {
|
||||
gim = pendingInstantMessages.Dequeue();
|
||||
im = gim.im;
|
||||
result = gim.result;
|
||||
} else {
|
||||
gim = null;
|
||||
-- numInstantMessageThreads;
|
||||
//m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads);
|
||||
}
|
||||
}
|
||||
} while (gim != null);
|
||||
}
|
||||
private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID)
|
||||
{
|
||||
|
||||
UUID toAgentID = new UUID(im.toAgentID);
|
||||
|
||||
PresenceInfo upd = null;
|
||||
@@ -576,7 +523,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
|
||||
if (upd != null)
|
||||
{
|
||||
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero,
|
||||
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
|
||||
upd.RegionID);
|
||||
if (reginfo != null)
|
||||
{
|
||||
@@ -725,8 +672,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
gim["position_z"] = msg.Position.Z.ToString();
|
||||
gim["region_id"] = msg.RegionID.ToString();
|
||||
gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None);
|
||||
if (m_MessageKey != String.Empty)
|
||||
gim["message_key"] = m_MessageKey;
|
||||
return gim;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,11 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
|
||||
private void RetrieveInstantMessages(IClientAPI client)
|
||||
{
|
||||
if (m_RestURL == String.Empty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (m_RestURL != "")
|
||||
{
|
||||
m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId);
|
||||
|
||||
@@ -183,25 +179,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
= SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>(
|
||||
"POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
|
||||
|
||||
if (msglist != null)
|
||||
if (msglist == null)
|
||||
m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list.");
|
||||
|
||||
foreach (GridInstantMessage im in msglist)
|
||||
{
|
||||
foreach (GridInstantMessage im in msglist)
|
||||
{
|
||||
// client.SendInstantMessage(im);
|
||||
// client.SendInstantMessage(im);
|
||||
|
||||
// Send through scene event manager so all modules get a chance
|
||||
// to look at this message before it gets delivered.
|
||||
//
|
||||
// Needed for proper state management for stored group
|
||||
// invitations
|
||||
//
|
||||
|
||||
im.offline = 1;
|
||||
|
||||
Scene s = FindScene(client.AgentId);
|
||||
if (s != null)
|
||||
s.EventManager.TriggerIncomingInstantMessage(im);
|
||||
}
|
||||
// Send through scene event manager so all modules get a chance
|
||||
// to look at this message before it gets delivered.
|
||||
//
|
||||
// Needed for proper state management for stored group
|
||||
// invitations
|
||||
//
|
||||
Scene s = FindScene(client.AgentId);
|
||||
if (s != null)
|
||||
s.EventManager.TriggerIncomingInstantMessage(im);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,19 +205,24 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
|
||||
im.dialog != (byte)InstantMessageDialog.GroupNotice &&
|
||||
im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
|
||||
im.dialog != (byte)InstantMessageDialog.InventoryOffered &&
|
||||
im.dialog != (byte)InstantMessageDialog.TaskInventoryOffered)
|
||||
im.dialog != (byte)InstantMessageDialog.InventoryOffered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_ForwardOfflineGroupMessages)
|
||||
{
|
||||
if (im.dialog == (byte)InstantMessageDialog.GroupNotice ||
|
||||
im.dialog != (byte)InstantMessageDialog.GroupInvitation)
|
||||
return;
|
||||
}
|
||||
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL+"/SaveMessage/?scope=" +
|
||||
scene.RegionInfo.ScopeID.ToString(), im);
|
||||
"POST", m_RestURL+"/SaveMessage/", im);
|
||||
|
||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
{
|
||||
|
||||
@@ -635,4 +635,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_assetsLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,8 +492,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
return null;
|
||||
}
|
||||
|
||||
return account;
|
||||
/*
|
||||
try
|
||||
{
|
||||
string encpass = Util.Md5Hash(pass);
|
||||
@@ -514,7 +512,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message);
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -350,38 +350,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
/// an account exists with the same name as the creator, though not the same id.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLoadIarV0_1SameNameCreator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
|
||||
|
||||
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
|
||||
InventoryItemBase foundItem1
|
||||
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
|
||||
|
||||
Assert.That(
|
||||
foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
|
||||
"Loaded item non-uuid creator doesn't match original");
|
||||
Assert.That(
|
||||
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
|
||||
"Loaded item uuid creator doesn't match original");
|
||||
Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
|
||||
"Loaded item owner doesn't match inventory reciever");
|
||||
|
||||
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
|
||||
string xmlData = Utils.BytesToString(asset1.Data);
|
||||
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
|
||||
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
// /// an account exists with the same name as the creator, though not the same id.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void TestLoadIarV0_1SameNameCreator()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
//
|
||||
// UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
|
||||
// UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
|
||||
//
|
||||
// m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
|
||||
// InventoryItemBase foundItem1
|
||||
// = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
|
||||
//
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
|
||||
// "Loaded item non-uuid creator doesn't match original");
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
|
||||
// "Loaded item uuid creator doesn't match original");
|
||||
// Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
|
||||
// "Loaded item owner doesn't match inventory reciever");
|
||||
//
|
||||
// AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
|
||||
// string xmlData = Utils.BytesToString(asset1.Data);
|
||||
// SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
//
|
||||
// Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
|
||||
@@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
if (im.binaryBucket.Length < 17) // Invalid
|
||||
return;
|
||||
|
||||
UUID recipientID = new UUID(im.toAgentID);
|
||||
ScenePresence user = scene.GetScenePresence(recipientID);
|
||||
UUID receipientID = new UUID(im.toAgentID);
|
||||
ScenePresence user = scene.GetScenePresence(receipientID);
|
||||
UUID copyID;
|
||||
|
||||
// First byte is the asset type
|
||||
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
folderID, new UUID(im.toAgentID));
|
||||
|
||||
InventoryFolderBase folderCopy
|
||||
= scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero);
|
||||
= scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero);
|
||||
|
||||
if (folderCopy == null)
|
||||
{
|
||||
@@ -244,8 +244,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
im.imSessionID = itemID.Guid;
|
||||
}
|
||||
|
||||
im.offline = 0;
|
||||
|
||||
// Send the IM to the recipient. The item is already
|
||||
// in their inventory, so it will not be lost if
|
||||
// they are offline.
|
||||
@@ -265,42 +263,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted ||
|
||||
im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
|
||||
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
|
||||
{
|
||||
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
// Special case: folder redirect.
|
||||
// RLV uses this
|
||||
if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase(inventoryID, client.AgentId);
|
||||
folder = invService.GetFolder(folder);
|
||||
|
||||
if (folder != null)
|
||||
{
|
||||
if (im.binaryBucket.Length >= 16)
|
||||
{
|
||||
UUID destFolderID = new UUID(im.binaryBucket, 0);
|
||||
if (destFolderID != UUID.Zero)
|
||||
{
|
||||
InventoryFolderBase destFolder = new InventoryFolderBase(destFolderID, client.AgentId);
|
||||
destFolder = invService.GetFolder(destFolder);
|
||||
if (destFolder != null)
|
||||
{
|
||||
if (folder.ParentID != destFolder.ID)
|
||||
{
|
||||
folder.ParentID = destFolder.ID;
|
||||
invService.MoveFolder(folder);
|
||||
client.SendBulkUpdateInventory(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||
|
||||
if (user != null) // Local
|
||||
@@ -310,7 +274,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
else
|
||||
{
|
||||
if (m_TransferModule != null)
|
||||
m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
|
||||
m_TransferModule.SendInstantMessage(im, delegate(bool success) {
|
||||
|
||||
// justincc - FIXME: Comment out for now. This code was added in commit db91044 Mon Aug 22 2011
|
||||
// and is apparently supposed to fix bulk inventory updates after accepting items. But
|
||||
// instead it appears to cause two copies of an accepted folder for the receiving user in
|
||||
// at least some cases. Folder/item update is already done when the offer is made (see code above)
|
||||
|
||||
// // Send BulkUpdateInventory
|
||||
// IInventoryService invService = scene.InventoryService;
|
||||
// UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip
|
||||
//
|
||||
// InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
|
||||
// folder = invService.GetFolder(folder);
|
||||
//
|
||||
// ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID));
|
||||
//
|
||||
// // If the user has left the scene by the time the message comes back then we can't send
|
||||
// // them the update.
|
||||
// if (fromUser != null)
|
||||
// fromUser.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (
|
||||
@@ -351,7 +335,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
{
|
||||
folder.ParentID = trashFolder.ID;
|
||||
invService.MoveFolder(folder);
|
||||
client.SendBulkUpdateInventory(folder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,113 +435,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="msg"></param>
|
||||
private void OnGridInstantMessage(GridInstantMessage im)
|
||||
private void OnGridInstantMessage(GridInstantMessage msg)
|
||||
{
|
||||
// Check if this is ours to handle
|
||||
//
|
||||
Scene scene = FindClientScene(new UUID(im.toAgentID));
|
||||
Scene scene = FindClientScene(new UUID(msg.toAgentID));
|
||||
|
||||
if (scene == null)
|
||||
return;
|
||||
|
||||
// Find agent to deliver to
|
||||
//
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||
if (user == null)
|
||||
return;
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID));
|
||||
|
||||
// This requires a little bit of processing because we have to make the
|
||||
// new item visible in the recipient's inventory here
|
||||
//
|
||||
if (im.dialog == (byte) InstantMessageDialog.InventoryOffered)
|
||||
{
|
||||
if (im.binaryBucket.Length < 17) // Invalid
|
||||
return;
|
||||
|
||||
UUID recipientID = new UUID(im.toAgentID);
|
||||
// Just forward to local handling
|
||||
OnInstantMessage(user.ControllingClient, msg);
|
||||
|
||||
// First byte is the asset type
|
||||
AssetType assetType = (AssetType)im.binaryBucket[0];
|
||||
|
||||
if (AssetType.Folder == assetType)
|
||||
{
|
||||
UUID folderID = new UUID(im.binaryBucket, 1);
|
||||
|
||||
InventoryFolderBase given =
|
||||
new InventoryFolderBase(folderID, recipientID);
|
||||
InventoryFolderBase folder =
|
||||
scene.InventoryService.GetFolder(given);
|
||||
|
||||
if (folder != null)
|
||||
user.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID itemID = new UUID(im.binaryBucket, 1);
|
||||
|
||||
InventoryItemBase given =
|
||||
new InventoryItemBase(itemID, recipientID);
|
||||
InventoryItemBase item =
|
||||
scene.InventoryService.GetItem(given);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
user.ControllingClient.SendBulkUpdateInventory(item);
|
||||
}
|
||||
}
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
}
|
||||
if (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered)
|
||||
{
|
||||
if (im.binaryBucket.Length < 1) // Invalid
|
||||
return;
|
||||
|
||||
UUID recipientID = new UUID(im.toAgentID);
|
||||
|
||||
// Bucket is the asset type
|
||||
AssetType assetType = (AssetType)im.binaryBucket[0];
|
||||
|
||||
if (AssetType.Folder == assetType)
|
||||
{
|
||||
UUID folderID = new UUID(im.imSessionID);
|
||||
|
||||
InventoryFolderBase given =
|
||||
new InventoryFolderBase(folderID, recipientID);
|
||||
InventoryFolderBase folder =
|
||||
scene.InventoryService.GetFolder(given);
|
||||
|
||||
if (folder != null)
|
||||
user.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID itemID = new UUID(im.imSessionID);
|
||||
|
||||
InventoryItemBase given =
|
||||
new InventoryItemBase(itemID, recipientID);
|
||||
InventoryItemBase item =
|
||||
scene.InventoryService.GetItem(given);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
user.ControllingClient.SendBulkUpdateInventory(item);
|
||||
}
|
||||
}
|
||||
|
||||
// Fix up binary bucket since this may be 17 chars long here
|
||||
Byte[] bucket = new Byte[1];
|
||||
bucket[0] = im.binaryBucket[0];
|
||||
im.binaryBucket = bucket;
|
||||
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
}
|
||||
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted ||
|
||||
im.dialog == (byte) InstantMessageDialog.InventoryDeclined ||
|
||||
im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined ||
|
||||
im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
|
||||
{
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,29 +161,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
scene.RegionInfo.RegionHandle,
|
||||
(uint)presence.AbsolutePosition.X,
|
||||
(uint)presence.AbsolutePosition.Y,
|
||||
(uint)presence.AbsolutePosition.Z + 2);
|
||||
(uint)Math.Ceiling(presence.AbsolutePosition.Z));
|
||||
|
||||
m_log.DebugFormat("[LURE]: TP invite with message {0}", message);
|
||||
|
||||
GridInstantMessage m;
|
||||
|
||||
if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid)))
|
||||
{
|
||||
m = new GridInstantMessage(scene, client.AgentId,
|
||||
client.FirstName+" "+client.LastName, targetid,
|
||||
(byte)InstantMessageDialog.GodLikeRequestTeleport, false,
|
||||
message, dest, false, presence.AbsolutePosition,
|
||||
new Byte[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m = new GridInstantMessage(scene, client.AgentId,
|
||||
client.FirstName+" "+client.LastName, targetid,
|
||||
(byte)InstantMessageDialog.RequestTeleport, false,
|
||||
message, dest, false, presence.AbsolutePosition,
|
||||
new Byte[0]);
|
||||
}
|
||||
m_log.DebugFormat("TP invite with message {0}", message);
|
||||
|
||||
GridInstantMessage m = new GridInstantMessage(scene, client.AgentId,
|
||||
client.FirstName+" "+client.LastName, targetid,
|
||||
(byte)InstantMessageDialog.RequestTeleport, false,
|
||||
message, dest, false, presence.AbsolutePosition,
|
||||
new Byte[0]);
|
||||
|
||||
if (m_TransferModule != null)
|
||||
{
|
||||
m_TransferModule.SendInstantMessage(m,
|
||||
@@ -218,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
{
|
||||
// Forward remote teleport requests
|
||||
//
|
||||
if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport &&
|
||||
msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport)
|
||||
if (msg.dialog != 22)
|
||||
return;
|
||||
|
||||
if (m_TransferModule != null)
|
||||
|
||||
@@ -102,8 +102,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
|
||||
public void CreateCaps(UUID agentId)
|
||||
{
|
||||
int flags = m_scene.GetUserFlags(agentId);
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
|
||||
return;
|
||||
|
||||
String capsObjectPath = GetCapsPath(agentId);
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
protected virtual void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnTeleportHomeRequest += TriggerTeleportHome;
|
||||
client.OnTeleportHomeRequest += TeleportHome;
|
||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags;
|
||||
sp.Velocity = Vector3.Zero;
|
||||
sp.Teleport(position);
|
||||
|
||||
@@ -430,7 +429,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
|
||||
// it's actually doing a lot of work.
|
||||
IPEndPoint endPoint = finalDestination.ExternalEndPoint;
|
||||
if (endPoint == null || endPoint.Address == null)
|
||||
|
||||
if (endPoint.Address == null)
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
|
||||
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
|
||||
@@ -644,7 +644,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// an agent cannot teleport back to this region if it has teleported away.
|
||||
Thread.Sleep(2000);
|
||||
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -781,12 +781,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
#region Teleport Home
|
||||
|
||||
public virtual void TriggerTeleportHome(UUID id, IClientAPI client)
|
||||
{
|
||||
TeleportHome(id, client);
|
||||
}
|
||||
|
||||
public virtual bool TeleportHome(UUID id, IClientAPI client)
|
||||
public virtual void TeleportHome(UUID id, IClientAPI client)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
||||
@@ -796,18 +791,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
if (uinfo != null)
|
||||
{
|
||||
if (uinfo.HomeRegionID == UUID.Zero)
|
||||
{
|
||||
// can't find the Home region: Tell viewer and abort
|
||||
client.SendTeleportFailed("You don't have a home position set.");
|
||||
return false;
|
||||
}
|
||||
GridRegion regionInfo = Scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
||||
if (regionInfo == null)
|
||||
{
|
||||
// can't find the Home region: Tell viewer and abort
|
||||
client.SendTeleportFailed("Your home region could not be found.");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Home region of {0} is {1} ({2}-{3})",
|
||||
@@ -820,11 +809,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
else
|
||||
{
|
||||
// can't find the Home region: Tell viewer and abort
|
||||
client.SendTeleportFailed("Your home region could not be found.");
|
||||
return false;
|
||||
m_log.ErrorFormat(
|
||||
"[ENTITY TRANSFER MODULE]: No grid user information found for {0} {1}. Cannot send home.",
|
||||
client.Name, client.AgentId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -832,10 +820,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
#region Agent Crossings
|
||||
|
||||
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos)
|
||||
public bool Cross(ScenePresence agent, bool isFlying)
|
||||
{
|
||||
version = String.Empty;
|
||||
newpos = new Vector3(pos.X, pos.Y, pos.Z);
|
||||
Scene scene = agent.Scene;
|
||||
Vector3 pos = agent.AbsolutePosition;
|
||||
Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
|
||||
uint neighbourx = scene.RegionInfo.RegionLocX;
|
||||
uint neighboury = scene.RegionInfo.RegionLocY;
|
||||
const float boundaryDistance = 1.7f;
|
||||
@@ -856,12 +845,52 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
|
||||
{
|
||||
neighboury--;
|
||||
newpos.Y = Constants.RegionSize - enterDistance;
|
||||
Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
|
||||
if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
|
||||
{
|
||||
neighboury--;
|
||||
newpos.Y = Constants.RegionSize - enterDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
agent.IsInTransit = true;
|
||||
|
||||
neighboury = b.TriggerRegionY;
|
||||
neighbourx = b.TriggerRegionX;
|
||||
|
||||
Vector3 newposition = pos;
|
||||
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
|
||||
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
|
||||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W);
|
||||
if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
|
||||
{
|
||||
neighbourx--;
|
||||
newpos.X = Constants.RegionSize - enterDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
agent.IsInTransit = true;
|
||||
|
||||
neighboury = ba.TriggerRegionY;
|
||||
neighbourx = ba.TriggerRegionX;
|
||||
|
||||
Vector3 newposition = pos;
|
||||
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
|
||||
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
|
||||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
neighbourx--;
|
||||
newpos.X = Constants.RegionSize - enterDistance;
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
|
||||
{
|
||||
@@ -871,8 +900,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
if (scene.TestBorderCross(pos + southCross, Cardinals.S))
|
||||
{
|
||||
neighboury--;
|
||||
newpos.Y = Constants.RegionSize - enterDistance;
|
||||
Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
|
||||
if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
|
||||
{
|
||||
neighboury--;
|
||||
newpos.Y = Constants.RegionSize - enterDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
agent.IsInTransit = true;
|
||||
|
||||
neighboury = ba.TriggerRegionY;
|
||||
neighbourx = ba.TriggerRegionX;
|
||||
Vector3 newposition = pos;
|
||||
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
|
||||
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
|
||||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
|
||||
{
|
||||
@@ -884,8 +931,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
|
||||
{
|
||||
Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
|
||||
neighboury--;
|
||||
newpos.Y = Constants.RegionSize - enterDistance;
|
||||
if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
|
||||
{
|
||||
neighboury--;
|
||||
newpos.Y = Constants.RegionSize - enterDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
agent.IsInTransit = true;
|
||||
|
||||
neighboury = b.TriggerRegionY;
|
||||
neighbourx = b.TriggerRegionX;
|
||||
Vector3 newposition = pos;
|
||||
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
|
||||
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
|
||||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
|
||||
{
|
||||
@@ -919,22 +983,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
*/
|
||||
|
||||
xDest = neighbourx;
|
||||
yDest = neighboury;
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
|
||||
int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
|
||||
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)x, (uint)y);
|
||||
|
||||
ExpiringCache<ulong, DateTime> r;
|
||||
DateTime banUntil;
|
||||
|
||||
if (m_bannedRegions.TryGetValue(agentID, out r))
|
||||
if (m_bannedRegions.TryGetValue(agent.ControllingClient.AgentId, out r))
|
||||
{
|
||||
if (r.TryGetValue(neighbourHandle, out banUntil))
|
||||
{
|
||||
if (DateTime.Now < banUntil)
|
||||
return null;
|
||||
return false;
|
||||
r.Remove(neighbourHandle);
|
||||
}
|
||||
}
|
||||
@@ -946,43 +1007,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
string reason;
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason))
|
||||
string version;
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
|
||||
{
|
||||
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
|
||||
if (r == null)
|
||||
{
|
||||
r = new ExpiringCache<ulong, DateTime>();
|
||||
r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
|
||||
|
||||
m_bannedRegions.Add(agentID, r, TimeSpan.FromSeconds(45));
|
||||
m_bannedRegions.Add(agent.ControllingClient.AgentId, r, TimeSpan.FromSeconds(45));
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return neighbourRegion;
|
||||
}
|
||||
|
||||
public bool Cross(ScenePresence agent, bool isFlying)
|
||||
{
|
||||
uint x;
|
||||
uint y;
|
||||
Vector3 newpos;
|
||||
string version;
|
||||
|
||||
GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos);
|
||||
if (neighbourRegion == null)
|
||||
{
|
||||
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
|
||||
return false;
|
||||
}
|
||||
|
||||
agent.IsInTransit = true;
|
||||
|
||||
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
|
||||
d.BeginInvoke(agent, newpos, x, y, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1039,11 +1085,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
|
||||
|
||||
/// <summary>
|
||||
/// This Closes child agents on neighbouring regions
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
public ScenePresence CrossAgentToNewRegionAsync(
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(
|
||||
ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion,
|
||||
bool isFlying, string version)
|
||||
{
|
||||
@@ -1250,14 +1298,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.Id0 = currentAgentCircuit.Id0;
|
||||
}
|
||||
|
||||
IPEndPoint external = region.ExternalEndPoint;
|
||||
if (external != null)
|
||||
{
|
||||
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
|
||||
d.BeginInvoke(sp, agent, region, external, true,
|
||||
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
|
||||
d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true,
|
||||
InformClientOfNeighbourCompleted,
|
||||
d);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1838,31 +1882,27 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
Utils.LongToUInts(newRegionHandle, out x, out y);
|
||||
GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (destination != null)
|
||||
if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
|
||||
{
|
||||
if (CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
|
||||
return; // we did it
|
||||
m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
|
||||
|
||||
// We are going to move the object back to the old position so long as the old position
|
||||
// is in the region
|
||||
oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1);
|
||||
oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1);
|
||||
oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f);
|
||||
|
||||
grp.RootPart.GroupPosition = oldGroupPosition;
|
||||
|
||||
// Need to turn off the physics flags, otherwise the object will continue to attempt to
|
||||
// move out of the region creating an infinite loop of failed attempts to cross
|
||||
grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
|
||||
|
||||
grp.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
// no one or failed lets go back and tell physics to go on
|
||||
oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 0.5f, (float)Constants.RegionSize - 0.5f);
|
||||
oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 0.5f, (float)Constants.RegionSize - 0.5f);
|
||||
oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 0.5f, 4096.0f);
|
||||
|
||||
grp.AbsolutePosition = oldGroupPosition;
|
||||
grp.Velocity = Vector3.Zero;
|
||||
|
||||
if (grp.RootPart.PhysActor != null)
|
||||
grp.RootPart.PhysActor.CrossingFailure();
|
||||
|
||||
if (grp.RootPart.KeyframeMotion != null)
|
||||
grp.RootPart.KeyframeMotion.CrossingFailure();
|
||||
|
||||
grp.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Move the given scene object into a new region
|
||||
/// </summary>
|
||||
@@ -1913,30 +1953,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
grp, e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* done on caller ( not in attachments crossing for now)
|
||||
else
|
||||
{
|
||||
|
||||
if (!grp.IsDeleted)
|
||||
{
|
||||
PhysicsActor pa = grp.RootPart.PhysActor;
|
||||
if (pa != null)
|
||||
{
|
||||
pa.CrossingFailure();
|
||||
if (grp.RootPart.KeyframeMotion != null)
|
||||
{
|
||||
// moved to KeyframeMotion.CrossingFailure
|
||||
// grp.RootPart.Velocity = Vector3.Zero;
|
||||
grp.RootPart.KeyframeMotion.CrossingFailure();
|
||||
// grp.SendGroupRootTerseUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2021,4 +2048,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
protected override void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnTeleportHomeRequest += TriggerTeleportHome;
|
||||
client.OnTeleportHomeRequest += TeleportHome;
|
||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||
client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
|
||||
}
|
||||
@@ -195,12 +195,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout);
|
||||
}
|
||||
|
||||
public void TriggerTeleportHome(UUID id, IClientAPI client)
|
||||
{
|
||||
TeleportHome(id, client);
|
||||
}
|
||||
|
||||
public override bool TeleportHome(UUID id, IClientAPI client)
|
||||
public override void TeleportHome(UUID id, IClientAPI client)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
||||
@@ -211,7 +206,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
// local grid user
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
|
||||
return base.TeleportHome(id, client);
|
||||
base.TeleportHome(id, client);
|
||||
return;
|
||||
}
|
||||
|
||||
// Foreign user wants to go home
|
||||
@@ -221,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
client.SendTeleportFailed("Your information has been lost");
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString());
|
||||
@@ -231,7 +227,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
client.SendTeleportFailed("Your home region could not be found");
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId);
|
||||
@@ -239,7 +235,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
client.SendTeleportFailed("Internal error");
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
GridRegion homeGatekeeper = MakeRegion(aCircuit);
|
||||
@@ -247,8 +243,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
|
||||
aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
|
||||
|
||||
DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
||||
return true;
|
||||
DoTeleport(
|
||||
sp, homeGatekeeper, finalDestination,
|
||||
position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -360,12 +360,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
foreach (SceneObjectGroup objectGroup in objlist)
|
||||
{
|
||||
if (objectGroup.RootPart.KeyframeMotion != null)
|
||||
objectGroup.RootPart.KeyframeMotion.Stop();
|
||||
objectGroup.RootPart.SetForce(Vector3.Zero);
|
||||
objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false);
|
||||
objectGroup.RootPart.KeyframeMotion = null;
|
||||
|
||||
Vector3 inventoryStoredPosition = new Vector3
|
||||
(((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
|
||||
? 250
|
||||
@@ -376,19 +370,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
: objectGroup.AbsolutePosition.Y,
|
||||
objectGroup.AbsolutePosition.Z);
|
||||
|
||||
Quaternion inventoryStoredRotation = objectGroup.GroupRotation;
|
||||
originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
|
||||
|
||||
// Restore attachment data after trip through the sim
|
||||
if (objectGroup.RootPart.AttachPoint > 0)
|
||||
{
|
||||
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
|
||||
inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
|
||||
}
|
||||
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
|
||||
|
||||
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
||||
objectGroup.RootPart.RotationOffset = inventoryStoredRotation;
|
||||
|
||||
// Make sure all bits but the ones we want are clear
|
||||
// on take.
|
||||
@@ -506,17 +490,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
IClientAPI remoteClient)
|
||||
{
|
||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7;
|
||||
// For the porposes of inventory, an object is modify if the prims
|
||||
// are modify. This allows renaming an object that contains no
|
||||
// mod items.
|
||||
foreach (SceneObjectGroup grp in objsForEffectivePermissions)
|
||||
{
|
||||
uint groupPerms = grp.GetEffectivePermissions(true);
|
||||
if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0)
|
||||
groupPerms |= (uint)PermissionMask.Modify;
|
||||
|
||||
effectivePerms &= groupPerms;
|
||||
}
|
||||
effectivePerms &= grp.GetEffectivePermissions();
|
||||
effectivePerms |= (uint)PermissionMask.Move;
|
||||
|
||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||
@@ -695,8 +670,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
|
||||
{
|
||||
InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
|
||||
if (f != null)
|
||||
folder = m_Scene.InventoryService.GetFolder(f);
|
||||
folder = m_Scene.InventoryService.GetFolder(f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,11 +700,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
|
||||
{
|
||||
// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = m_Scene.InventoryService.GetItem(item);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[INVENTORY ACCESS MODULE]: Could not find item {0} for {1} in RezObject()",
|
||||
itemID, remoteClient.Name);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -781,13 +760,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (e == null || attachment) // Single
|
||||
{
|
||||
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
if (!attachment)
|
||||
{
|
||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||
g.RootPart.AttachRotation = g.GroupRotation;
|
||||
g.RootPart.Shape.State = 0;
|
||||
}
|
||||
|
||||
objlist.Add(g);
|
||||
veclist.Add(new Vector3(0, 0, 0));
|
||||
@@ -817,10 +789,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
foreach (XmlNode n in groups)
|
||||
{
|
||||
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
|
||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||
g.RootPart.AttachRotation = g.GroupRotation;
|
||||
g.RootPart.Shape.State = 0;
|
||||
|
||||
objlist.Add(g);
|
||||
XmlElement el = (XmlElement)n;
|
||||
@@ -840,35 +808,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
}
|
||||
}
|
||||
|
||||
int primcount = 0;
|
||||
foreach (SceneObjectGroup g in objlist)
|
||||
primcount += g.PrimCount;
|
||||
|
||||
if (!m_Scene.Permissions.CanRezObject(
|
||||
primcount, remoteClient.AgentId, pos)
|
||||
&& !attachment)
|
||||
{
|
||||
// The client operates in no fail mode. It will
|
||||
// have already removed the item from the folder
|
||||
// if it's no copy.
|
||||
// Put it back if it's not an attachment
|
||||
//
|
||||
if (item != null)
|
||||
{
|
||||
if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
|
||||
remoteClient.SendBulkUpdateInventory(item);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment))
|
||||
return null;
|
||||
|
||||
for (int i = 0; i < objlist.Count; i++)
|
||||
{
|
||||
group = objlist[i];
|
||||
SceneObjectPart rootPart = group.RootPart;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
|
||||
@@ -929,6 +874,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
if (!attachment)
|
||||
{
|
||||
SceneObjectPart rootPart = group.RootPart;
|
||||
|
||||
if (rootPart.Shape.PCode == (byte)PCode.Prim)
|
||||
group.ClearPartAttachmentData();
|
||||
|
||||
@@ -946,8 +893,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
// remoteClient.Name);
|
||||
}
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
|
||||
if (item != null)
|
||||
DoPostRezWhenFromItem(item, attachment);
|
||||
|
||||
@@ -1026,11 +971,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
{
|
||||
rootPart.Name = item.Name;
|
||||
rootPart.Description = item.Description;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0)
|
||||
{
|
||||
rootPart.ObjectSaleType = item.SaleType;
|
||||
rootPart.SalePrice = item.SalePrice;
|
||||
}
|
||||
rootPart.ObjectSaleType = item.SaleType;
|
||||
rootPart.SalePrice = item.SalePrice;
|
||||
}
|
||||
|
||||
so.FromFolderID = item.Folder;
|
||||
@@ -1040,8 +982,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
||||
|
||||
if ((rootPart.OwnerID != item.Owner) ||
|
||||
(item.CurrentPermissions & 16) != 0 ||
|
||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||
(item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
//Need to kill the for sale here
|
||||
rootPart.ObjectSaleType = 0;
|
||||
@@ -1051,43 +992,31 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
{
|
||||
foreach (SceneObjectPart part in so.Parts)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
|
||||
so.ApplyNextOwnerPermissions();
|
||||
|
||||
// In case the user has changed flags on a received item
|
||||
// we have to apply those changes after the slam. Else we
|
||||
// get a net loss of permissions
|
||||
foreach (SceneObjectPart part in so.Parts)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
foreach (SceneObjectPart part in so.Parts)
|
||||
{
|
||||
foreach (SceneObjectPart part in so.Parts)
|
||||
{
|
||||
part.FromUserInventoryItemID = fromUserInventoryItemId;
|
||||
part.FromUserInventoryItemID = fromUserInventoryItemId;
|
||||
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
if ((part.OwnerID != item.Owner) ||
|
||||
(item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
@@ -1225,4 +1154,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,9 +90,9 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
||||
}
|
||||
}
|
||||
|
||||
protected override List<MapBlockData> GetAndSendBlocksInternal(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
protected override List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
{
|
||||
List<MapBlockData> mapBlocks = base.GetAndSendBlocksInternal(remoteClient, minX, minY, maxX, maxY, flag);
|
||||
List<MapBlockData> mapBlocks = base.GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag);
|
||||
lock (m_SeenMapBlocks)
|
||||
{
|
||||
if (!m_SeenMapBlocks.ContainsKey(remoteClient.AgentId))
|
||||
|
||||
@@ -170,8 +170,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
|
||||
private void EventManager_OnMakeRootAgent(ScenePresence presence)
|
||||
{
|
||||
if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
|
||||
m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
|
||||
m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
|
||||
SendProfileToClient(presence.ControllingClient);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user