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)
|
||||
|
||||
@@ -47,36 +47,36 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetTextureHandler
|
||||
public class GetTextureHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAssetService m_assetService;
|
||||
|
||||
public const string DefaultFormat = "x-j2c";
|
||||
|
||||
public GetTextureHandler(IAssetService assService)
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public Hashtable Handle(Hashtable request)
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
Hashtable ret = new Hashtable();
|
||||
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
||||
ret["content_type"] = "text/plain";
|
||||
ret["keepalive"] = false;
|
||||
ret["reusecontext"] = false;
|
||||
|
||||
string textureStr = (string)request["texture_id"];
|
||||
string format = (string)request["format"];
|
||||
// Try to parse the texture ID from the request URL
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string textureStr = query.GetOne("texture_id");
|
||||
string format = query.GetOne("format");
|
||||
|
||||
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
||||
|
||||
if (m_assetService == null)
|
||||
{
|
||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
}
|
||||
|
||||
UUID textureID;
|
||||
@@ -91,30 +91,30 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
else
|
||||
{
|
||||
formats = new string[1] { DefaultFormat }; // default
|
||||
if (((Hashtable)request["headers"])["Accept"] != null)
|
||||
formats = WebUtil.GetPreferredImageTypes((string)((Hashtable)request["headers"])["Accept"]);
|
||||
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
|
||||
if (formats.Length == 0)
|
||||
formats = new string[1] { DefaultFormat }; // default
|
||||
|
||||
}
|
||||
// OK, we have an array with preferred formats, possibly with only one entry
|
||||
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
foreach (string f in formats)
|
||||
{
|
||||
if (FetchTexture(request, ret, textureID, f))
|
||||
if (FetchTexture(httpRequest, httpResponse, textureID, f))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + (string)request["uri"]);
|
||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
||||
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
||||
return ret;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,7 +125,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
/// <param name="textureID"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
||||
private bool FetchTexture(Hashtable request, Hashtable response, UUID textureID, string format)
|
||||
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||
AssetBase texture;
|
||||
@@ -134,65 +134,84 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if (format != DefaultFormat)
|
||||
fullID = fullID + "-" + format;
|
||||
|
||||
// try the cache
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
if (texture == null)
|
||||
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||
|
||||
// Fetch locally or remotely. Misses return a 404
|
||||
texture = m_assetService.Get(textureID.ToString());
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
return true;
|
||||
|
||||
if (format == DefaultFormat)
|
||||
{
|
||||
WriteTextureData(request, response, texture, format);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
|
||||
newTexture.Data = ConvertTextureData(texture, format);
|
||||
if (newTexture.Data.Length == 0)
|
||||
return false; // !!! Caller try another codec, please!
|
||||
|
||||
newTexture.Flags = AssetFlags.Collectable;
|
||||
newTexture.Temporary = true;
|
||||
m_assetService.Store(newTexture);
|
||||
WriteTextureData(request, response, newTexture, format);
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
}
|
||||
}
|
||||
else // it was on the cache
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||
WriteTextureData(request, response, texture, format);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string textureUrl = REDIRECT_URL + textureID.ToString();
|
||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||
httpResponse.RedirectLocation = textureUrl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else // no redirect
|
||||
{
|
||||
// try the cache
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||
|
||||
// Fetch locally or remotely. Misses return a 404
|
||||
texture = m_assetService.Get(textureID.ToString());
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
if (format == DefaultFormat)
|
||||
{
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
|
||||
newTexture.Data = ConvertTextureData(texture, format);
|
||||
if (newTexture.Data.Length == 0)
|
||||
return false; // !!! Caller try another codec, please!
|
||||
|
||||
newTexture.Flags = AssetFlags.Collectable;
|
||||
newTexture.Temporary = true;
|
||||
m_assetService.Store(newTexture);
|
||||
WriteTextureData(httpRequest, httpResponse, newTexture, format);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // it was on the cache
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// not found
|
||||
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format)
|
||||
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
|
||||
{
|
||||
Hashtable headers = new Hashtable();
|
||||
response["headers"] = headers;
|
||||
|
||||
string range = String.Empty;
|
||||
|
||||
if (((Hashtable)request["headers"])["range"] != null)
|
||||
range = (string)((Hashtable)request["headers"])["range"];
|
||||
|
||||
else if (((Hashtable)request["headers"])["Range"] != null)
|
||||
range = (string)((Hashtable)request["headers"])["Range"];
|
||||
string range = request.Headers.GetOne("Range");
|
||||
|
||||
if (!String.IsNullOrEmpty(range)) // JP2's only
|
||||
{
|
||||
@@ -205,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["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -217,42 +234,35 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
response["content-type"] = texture.Metadata.ContentType;
|
||||
// Always return PartialContent, even if the range covered the entire data length
|
||||
// We were accidentally sending back 404 before in this situation
|
||||
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
|
||||
// entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
||||
if (start == 0 && len == texture.Data.Length) // well redudante maybe
|
||||
{
|
||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
||||
response["bin_response_data"] = texture.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length);
|
||||
|
||||
byte[] d = new byte[len];
|
||||
Array.Copy(texture.Data, start, d, 0, len);
|
||||
response["bin_response_data"] = d;
|
||||
}
|
||||
// response.Body.Write(texture.Data, start, len);
|
||||
response.ContentLength = len;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
||||
|
||||
response.Body.Write(texture.Data, start, len);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
|
||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.BadRequest;
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||
}
|
||||
}
|
||||
else // JP2's or other formats
|
||||
{
|
||||
// Full content request
|
||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
response.ContentLength = texture.Data.Length;
|
||||
if (format == DefaultFormat)
|
||||
response["content_type"] = texture.Metadata.ContentType;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
else
|
||||
response["content_type"] = "image/" + format;
|
||||
|
||||
response["bin_response_data"] = texture.Data;
|
||||
// response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||
response.ContentType = "image/" + format;
|
||||
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||
}
|
||||
|
||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
||||
@@ -356,4 +366,4 @@ namespace OpenSim.Capabilities.Handlers
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
/*
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetTextureServerConnector : ServiceConnector
|
||||
@@ -64,8 +63,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
server.AddStreamHandler(
|
||||
new GetTextureHandler("/CAPS/GetTexture/", m_AssetService, "GetTexture", null));
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -39,7 +39,6 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
/*
|
||||
namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -61,5 +60,4 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||
Assert.That(resp.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.NotFound));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -30,15 +30,12 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
|
||||
[LLSDType("MAP")]
|
||||
public class LLSDAssetUploadComplete
|
||||
{
|
||||
public string new_asset = String.Empty;
|
||||
public UUID new_inventory_item = UUID.Zero;
|
||||
// public UUID new_texture_folder_id = UUID.Zero;
|
||||
public string state = String.Empty;
|
||||
public LLSDAssetUploadError error = null;
|
||||
//public bool success = false;
|
||||
|
||||
public LLSDAssetUploadComplete()
|
||||
|
||||
@@ -30,28 +30,15 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDAssetResource
|
||||
{
|
||||
public OSDArray instance_list = new OSDArray();
|
||||
public OSDArray texture_list = new OSDArray();
|
||||
public OSDArray mesh_list = new OSDArray();
|
||||
public string metric = String.Empty;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadRequest
|
||||
{
|
||||
public string asset_type = String.Empty;
|
||||
public string description = String.Empty;
|
||||
public UUID folder_id = UUID.Zero;
|
||||
public UUID texture_folder_id = UUID.Zero;
|
||||
public int next_owner_mask = 0;
|
||||
public int group_mask = 0;
|
||||
public int everyone_mask = 0;
|
||||
public string inventory_type = String.Empty;
|
||||
public string name = String.Empty;
|
||||
public LLSDAssetResource asset_resources = new LLSDAssetResource();
|
||||
|
||||
public LLSDAssetUploadRequest()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -26,51 +26,20 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadError
|
||||
{
|
||||
public string message = String.Empty;
|
||||
public UUID identifier = UUID.Zero;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadResponsePricebrkDown
|
||||
{
|
||||
public int mesh_streaming;
|
||||
public int mesh_physics;
|
||||
public int mesh_instance;
|
||||
public int texture;
|
||||
public int model;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadResponseData
|
||||
{
|
||||
public double resource_cost;
|
||||
public double model_streaming_cost;
|
||||
public double simulation_cost;
|
||||
public double physics_cost;
|
||||
public LLSDAssetUploadResponsePricebrkDown upload_price_breakdown = new LLSDAssetUploadResponsePricebrkDown();
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDAssetUploadResponse
|
||||
{
|
||||
public string uploader = String.Empty;
|
||||
public string state = String.Empty;
|
||||
public int upload_price = 0;
|
||||
public LLSDAssetUploadResponseData data = null;
|
||||
public LLSDAssetUploadError error = null;
|
||||
|
||||
public LLSDAssetUploadResponse()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
@@ -150,8 +148,7 @@ namespace OpenSim.Framework
|
||||
Type == (sbyte)AssetType.SnapshotFolder ||
|
||||
Type == (sbyte)AssetType.TrashFolder ||
|
||||
Type == (sbyte)AssetType.ImageJPEG ||
|
||||
Type == (sbyte)AssetType.ImageTGA ||
|
||||
Type == (sbyte)AssetType.Mesh ||
|
||||
Type == (sbyte) AssetType.ImageTGA ||
|
||||
Type == (sbyte) AssetType.LSLBytecode);
|
||||
}
|
||||
}
|
||||
@@ -201,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,
|
||||
@@ -425,7 +425,7 @@ namespace OpenSim.Framework.Console
|
||||
return false;
|
||||
}
|
||||
|
||||
private Hashtable GetEvents(UUID RequestID, UUID sessionID)
|
||||
private Hashtable GetEvents(UUID RequestID, UUID sessionID, string request)
|
||||
{
|
||||
ConsoleConnection c = null;
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -1158,7 +1158,6 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
/// <param name="Item"></param>
|
||||
void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId);
|
||||
void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId);
|
||||
|
||||
void SendRemoveInventoryItem(UUID itemID);
|
||||
|
||||
@@ -1178,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);
|
||||
|
||||
@@ -1330,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;
|
||||
|
||||
@@ -45,8 +45,7 @@ namespace OpenSim.Framework
|
||||
/// <summary>
|
||||
/// Total number of queues (priorities) available
|
||||
/// </summary>
|
||||
|
||||
public const uint NumberOfQueues = 12; // includes immediate queues, m_queueCounts need to be set acording
|
||||
public const uint NumberOfQueues = 12;
|
||||
|
||||
/// <summary>
|
||||
/// Number of queuest (priorities) that are processed immediately
|
||||
@@ -61,8 +60,7 @@ namespace OpenSim.Framework
|
||||
// each pass. weighted towards the higher priority queues
|
||||
private uint m_nextQueue = 0;
|
||||
private uint m_countFromQueue = 0;
|
||||
// first queues are imediate, so no counts
|
||||
private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1};
|
||||
private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 };
|
||||
|
||||
// next request is a counter of the number of updates queued, it provides
|
||||
// a total ordering on the updates coming through the queue and is more
|
||||
@@ -139,7 +137,7 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
|
||||
{
|
||||
// If there is anything in imediate queues, return it first no
|
||||
// If there is anything in priority queue 0, return it first no
|
||||
// matter what else. Breaks fairness. But very useful.
|
||||
for (int iq = 0; iq < NumberOfImmediateQueues; iq++)
|
||||
{
|
||||
@@ -174,13 +172,14 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
// Find the next non-immediate queue with updates in it
|
||||
for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i)
|
||||
for (int i = 0; i < NumberOfQueues; ++i)
|
||||
{
|
||||
m_nextQueue++;
|
||||
if(m_nextQueue >= NumberOfQueues)
|
||||
m_nextQueue = NumberOfImmediateQueues;
|
||||
|
||||
m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues);
|
||||
m_countFromQueue = m_queueCounts[m_nextQueue];
|
||||
|
||||
// if this is one of the immediate queues, just skip it
|
||||
if (m_nextQueue < NumberOfImmediateQueues)
|
||||
continue;
|
||||
|
||||
if (m_heaps[m_nextQueue].Count > 0)
|
||||
{
|
||||
@@ -190,6 +189,7 @@ namespace OpenSim.Framework
|
||||
m_lookupTable.Remove(item.Value.Entity.LocalId);
|
||||
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
|
||||
value = item.Value;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -317,7 +317,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
StreamReader reader = new StreamReader(requestStream, encoding);
|
||||
|
||||
string requestBody = reader.ReadToEnd();
|
||||
reader.Close();
|
||||
|
||||
Hashtable keysvals = new Hashtable();
|
||||
Hashtable headervals = new Hashtable();
|
||||
@@ -641,7 +640,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
// Every month or so this will wrap and give bad numbers, not really a problem
|
||||
// since its just for reporting
|
||||
int tickdiff = requestEndTick - requestStartTick;
|
||||
if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture"))
|
||||
if (tickdiff > 3000)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
|
||||
@@ -1449,40 +1448,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
|
||||
{
|
||||
int responsecode;
|
||||
string responseString = String.Empty;
|
||||
byte[] responseData = null;
|
||||
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"];
|
||||
if (responsedata["bin_response_data"] != null)
|
||||
responseData = (byte[])responsedata["bin_response_data"];
|
||||
else
|
||||
responseString = (string)responsedata["str_response_string"];
|
||||
contentType = (string)responsedata["content_type"];
|
||||
if (responseString == null)
|
||||
responseString = String.Empty;
|
||||
}
|
||||
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"))
|
||||
{
|
||||
@@ -1527,41 +1496,26 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
response.AddHeader("Content-Type", contentType);
|
||||
|
||||
if (responsedata.ContainsKey("headers"))
|
||||
{
|
||||
Hashtable headerdata = (Hashtable)responsedata["headers"];
|
||||
|
||||
foreach (string header in headerdata.Keys)
|
||||
response.AddHeader(header, (string)headerdata[header]);
|
||||
}
|
||||
|
||||
byte[] buffer;
|
||||
|
||||
if (responseData != null)
|
||||
if (!(contentType.Contains("image")
|
||||
|| contentType.Contains("x-shockwave-flash")
|
||||
|| contentType.Contains("application/x-oar")
|
||||
|| contentType.Contains("application/vnd.ll.mesh")))
|
||||
{
|
||||
buffer = responseData;
|
||||
// Text
|
||||
buffer = Encoding.UTF8.GetBytes(responseString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(contentType.Contains("image")
|
||||
|| contentType.Contains("x-shockwave-flash")
|
||||
|| contentType.Contains("application/x-oar")
|
||||
|| contentType.Contains("application/vnd.ll.mesh")))
|
||||
{
|
||||
// Text
|
||||
buffer = Encoding.UTF8.GetBytes(responseString);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Binary!
|
||||
buffer = Convert.FromBase64String(responseString);
|
||||
}
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
// Binary!
|
||||
buffer = Convert.FromBase64String(responseString);
|
||||
}
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -1640,8 +1594,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_httpListener2.Start(64);
|
||||
|
||||
// Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
|
||||
// m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
|
||||
m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000);
|
||||
m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
|
||||
HTTPDRunning = true;
|
||||
|
||||
//HttpListenerContext context;
|
||||
@@ -1675,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)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public delegate void RequestMethod(UUID requestID, Hashtable request);
|
||||
public delegate bool HasEventsMethod(UUID requestID, UUID pId);
|
||||
|
||||
public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId);
|
||||
public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request);
|
||||
|
||||
public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId);
|
||||
|
||||
@@ -45,29 +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,
|
||||
Texture = 3
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,20 +33,15 @@ using log4net;
|
||||
using HttpServer;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using Amib.Threading;
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
@@ -72,6 +67,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
@@ -81,6 +77,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
@@ -94,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,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();
|
||||
@@ -157,274 +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 SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2);
|
||||
|
||||
// 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,
|
||||
false,
|
||||
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.Normal)
|
||||
{
|
||||
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)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
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()
|
||||
{
|
||||
while (m_running)
|
||||
{
|
||||
PollServiceHttpRequest req = m_requests.Dequeue(5000);
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
if (req != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||
{
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
|
||||
|
||||
if (responsedata == null)
|
||||
continue;
|
||||
|
||||
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoHTTPGruntWork(m_server, req, responsedata);
|
||||
}
|
||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||
{
|
||||
// Ignore it, no need to reply
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_threadPool.QueueWorkItem(x =>
|
||||
{
|
||||
try
|
||||
{
|
||||
DoHTTPGruntWork(m_server, req, responsedata);
|
||||
}
|
||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||
{
|
||||
// Ignore it, no need to reply
|
||||
}
|
||||
|
||||
return null;
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -75,10 +75,6 @@ namespace OpenSim.Framework.Servers.Tests
|
||||
/// </summary>
|
||||
public event EventHandler<RequestEventArgs> RequestReceived = delegate { };
|
||||
|
||||
public bool CanSend { get { return true; } }
|
||||
public string RemoteEndPoint { get { return ""; } }
|
||||
public string RemoteEndPointAddress { get { return ""; } }
|
||||
public string RemoteEndPointPort { get { return ""; } }
|
||||
}
|
||||
|
||||
public class TestHttpRequest: IHttpRequest
|
||||
|
||||
@@ -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)
|
||||
@@ -694,30 +693,18 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action)
|
||||
{
|
||||
MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, 0);
|
||||
}
|
||||
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action,
|
||||
int maxConnections)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
// int tickdata = 0;
|
||||
int tickdiff = 0;
|
||||
int tickdata = 0;
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
||||
|
||||
Type type = typeof(TRequest);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
HttpWebRequest ht = (HttpWebRequest)request;
|
||||
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
|
||||
ht.ServicePoint.ConnectionLimit = maxConnections;
|
||||
|
||||
WebResponse response = null;
|
||||
TResponse deserial = default(TResponse);
|
||||
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
|
||||
@@ -752,8 +739,8 @@ namespace OpenSim.Framework
|
||||
requestStream.Close();
|
||||
|
||||
// capture how much time was spent writing
|
||||
// useless in this async
|
||||
// tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult ar)
|
||||
{
|
||||
response = request.EndGetResponse(ar);
|
||||
@@ -770,8 +757,7 @@ namespace OpenSim.Framework
|
||||
finally
|
||||
{
|
||||
// Let's not close this
|
||||
// yes do close it
|
||||
buffer.Close();
|
||||
//buffer.Close();
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
@@ -839,6 +825,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
action(deserial);
|
||||
@@ -853,10 +840,9 @@ namespace OpenSim.Framework
|
||||
}, null);
|
||||
}
|
||||
|
||||
tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > WebUtil.LongCallTime)
|
||||
{
|
||||
/*
|
||||
string originalRequest = null;
|
||||
|
||||
if (buffer != null)
|
||||
@@ -875,13 +861,6 @@ namespace OpenSim.Framework
|
||||
tickdiff,
|
||||
tickdata,
|
||||
originalRequest);
|
||||
*/
|
||||
m_log.InfoFormat(
|
||||
"[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
tickdiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -912,8 +891,6 @@ namespace OpenSim.Framework
|
||||
request.Method = verb;
|
||||
string respstring = String.Empty;
|
||||
|
||||
int tickset = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
@@ -990,12 +967,11 @@ namespace OpenSim.Framework
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > WebUtil.LongCallTime)
|
||||
m_log.InfoFormat(
|
||||
"[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}",
|
||||
"[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
tickdiff,
|
||||
tickset,
|
||||
tickdata,
|
||||
obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
|
||||
|
||||
@@ -1020,16 +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)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
|
||||
}
|
||||
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
@@ -1041,13 +1007,7 @@ namespace OpenSim.Framework
|
||||
TResponse deserial = default(TResponse);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
HttpWebRequest ht = (HttpWebRequest)request;
|
||||
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
|
||||
ht.ServicePoint.ConnectionLimit = maxConnections;
|
||||
|
||||
request.Method = verb;
|
||||
if (pTimeout != 0)
|
||||
request.Timeout = pTimeout * 1000;
|
||||
MemoryStream buffer = null;
|
||||
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
@@ -1163,4 +1123,4 @@ namespace OpenSim.Framework
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
@@ -74,7 +73,6 @@ namespace OpenSim
|
||||
AppDomain.CurrentDomain.UnhandledException +=
|
||||
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
|
||||
ServicePointManager.DefaultConnectionLimit = 12;
|
||||
|
||||
// Add the arguments supplied when running the application to the configuration
|
||||
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,671 +0,0 @@
|
||||
// Proprietary code of Avination Virtual Limited
|
||||
// (c) 2012 Melanie Thielker, Leal Duarte
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
|
||||
using ComponentAce.Compression.Libs.zlib;
|
||||
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
public struct ModelPrimLimits
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ModelCost
|
||||
{
|
||||
|
||||
// upload fee defaults
|
||||
// fees are normalized to 1.0
|
||||
// this parameters scale them to basic cost ( so 1.0 translates to 10 )
|
||||
|
||||
public float ModelMeshCostFactor = 0.0f; // scale total cost relative to basic (excluding textures)
|
||||
public float ModelTextureCostFactor = 1.0f; // scale textures fee to basic.
|
||||
public float ModelMinCostFactor = 0.0f; // 0.5f; // minimum total model free excluding textures
|
||||
|
||||
// itens costs in normalized values
|
||||
// ie will be multiplied by basicCost and factors above
|
||||
public float primCreationCost = 0.002f; // extra cost for each prim creation overhead
|
||||
// weigthed size to normalized cost
|
||||
public float bytecost = 1e-5f;
|
||||
|
||||
// mesh upload fees based on compressed data sizes
|
||||
// several data sections are counted more that once
|
||||
// to promote user optimization
|
||||
// following parameters control how many extra times they are added
|
||||
// to global size.
|
||||
// LOD meshs
|
||||
const float medSizeWth = 1f; // 2x
|
||||
const float lowSizeWth = 1.5f; // 2.5x
|
||||
const float lowestSizeWth = 2f; // 3x
|
||||
// favor potencially physical optimized meshs versus automatic decomposition
|
||||
const float physMeshSizeWth = 6f; // counts 7x
|
||||
const float physHullSizeWth = 8f; // counts 9x
|
||||
|
||||
// stream cost area factors
|
||||
// more or less like SL
|
||||
const float highLodFactor = 17.36f;
|
||||
const float midLodFactor = 277.78f;
|
||||
const float lowLodFactor = 1111.11f;
|
||||
|
||||
// physics cost is below, identical to SL, assuming shape type convex
|
||||
// server cost is below identical to SL assuming non scripted non physical object
|
||||
|
||||
// internal
|
||||
const int bytesPerCoord = 6; // 3 coords, 2 bytes per each
|
||||
|
||||
// control prims dimensions
|
||||
public float PrimScaleMin = 0.001f;
|
||||
public float NonPhysicalPrimScaleMax = 256f;
|
||||
public float PhysicalPrimScaleMax = 10f;
|
||||
public int ObjectLinkedPartsMax = 512;
|
||||
|
||||
// storage for a single mesh asset cost parameters
|
||||
private class ameshCostParam
|
||||
{
|
||||
// LOD sizes for size dependent streaming cost
|
||||
public int highLODSize;
|
||||
public int medLODSize;
|
||||
public int lowLODSize;
|
||||
public int lowestLODSize;
|
||||
// normalized fee based on compressed data sizes
|
||||
public float costFee;
|
||||
// physics cost
|
||||
public float physicsCost;
|
||||
}
|
||||
|
||||
// calculates a mesh model costs
|
||||
// returns false on error, with a reason on parameter error
|
||||
// resources input LLSD request
|
||||
// basicCost input region assets upload cost
|
||||
// totalcost returns model total upload fee
|
||||
// meshcostdata returns detailed costs for viewer
|
||||
public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost,
|
||||
LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning)
|
||||
{
|
||||
totalcost = 0;
|
||||
error = string.Empty;
|
||||
|
||||
if (resources == null ||
|
||||
resources.instance_list == null ||
|
||||
resources.instance_list.Array.Count == 0)
|
||||
{
|
||||
error = "missing model information.";
|
||||
return false;
|
||||
}
|
||||
|
||||
int numberInstances = resources.instance_list.Array.Count;
|
||||
|
||||
if( numberInstances > ObjectLinkedPartsMax )
|
||||
{
|
||||
error = "Model whould have more than " + ObjectLinkedPartsMax.ToString() + " linked prims";
|
||||
return false;
|
||||
}
|
||||
|
||||
meshcostdata.model_streaming_cost = 0.0;
|
||||
meshcostdata.simulation_cost = 0.0;
|
||||
meshcostdata.physics_cost = 0.0;
|
||||
meshcostdata.resource_cost = 0.0;
|
||||
|
||||
meshcostdata.upload_price_breakdown.mesh_instance = 0;
|
||||
meshcostdata.upload_price_breakdown.mesh_physics = 0;
|
||||
meshcostdata.upload_price_breakdown.mesh_streaming = 0;
|
||||
meshcostdata.upload_price_breakdown.model = 0;
|
||||
|
||||
int itmp;
|
||||
|
||||
// textures cost
|
||||
if (resources.texture_list != null && resources.texture_list.Array.Count > 0)
|
||||
{
|
||||
float textures_cost = (float)(resources.texture_list.Array.Count * basicCost);
|
||||
textures_cost *= ModelTextureCostFactor;
|
||||
|
||||
itmp = (int)(textures_cost + 0.5f); // round
|
||||
meshcostdata.upload_price_breakdown.texture = itmp;
|
||||
totalcost += itmp;
|
||||
}
|
||||
|
||||
// meshs assets cost
|
||||
float meshsfee = 0;
|
||||
int numberMeshs = 0;
|
||||
bool haveMeshs = false;
|
||||
List<ameshCostParam> meshsCosts = new List<ameshCostParam>();
|
||||
|
||||
if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
|
||||
{
|
||||
numberMeshs = resources.mesh_list.Array.Count;
|
||||
|
||||
for (int i = 0; i < numberMeshs; i++)
|
||||
{
|
||||
ameshCostParam curCost = new ameshCostParam();
|
||||
byte[] data = (byte[])resources.mesh_list.Array[i];
|
||||
|
||||
if (!MeshCost(data, curCost, out error))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
meshsCosts.Add(curCost);
|
||||
meshsfee += curCost.costFee;
|
||||
}
|
||||
haveMeshs = true;
|
||||
}
|
||||
|
||||
// instances (prims) cost
|
||||
|
||||
|
||||
int mesh;
|
||||
int skipedSmall = 0;
|
||||
for (int i = 0; i < numberInstances; i++)
|
||||
{
|
||||
Hashtable inst = (Hashtable)resources.instance_list.Array[i];
|
||||
|
||||
ArrayList ascale = (ArrayList)inst["scale"];
|
||||
Vector3 scale;
|
||||
double tmp;
|
||||
tmp = (double)ascale[0];
|
||||
scale.X = (float)tmp;
|
||||
tmp = (double)ascale[1];
|
||||
scale.Y = (float)tmp;
|
||||
tmp = (double)ascale[2];
|
||||
scale.Z = (float)tmp;
|
||||
|
||||
if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin)
|
||||
{
|
||||
skipedSmall++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax)
|
||||
{
|
||||
error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (haveMeshs && inst.ContainsKey("mesh"))
|
||||
{
|
||||
mesh = (int)inst["mesh"];
|
||||
|
||||
if (mesh >= numberMeshs)
|
||||
{
|
||||
error = "Incoerent model information.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// streamming cost
|
||||
|
||||
float sqdiam = scale.LengthSquared();
|
||||
|
||||
ameshCostParam curCost = meshsCosts[mesh];
|
||||
float mesh_streaming = streamingCost(curCost, sqdiam);
|
||||
|
||||
meshcostdata.model_streaming_cost += mesh_streaming;
|
||||
meshcostdata.physics_cost += curCost.physicsCost;
|
||||
}
|
||||
else // instance as no mesh ??
|
||||
{
|
||||
// to do later if needed
|
||||
meshcostdata.model_streaming_cost += 0.5f;
|
||||
meshcostdata.physics_cost += 1.0f;
|
||||
}
|
||||
|
||||
// assume unscripted and static prim server cost
|
||||
meshcostdata.simulation_cost += 0.5f;
|
||||
// charge for prims creation
|
||||
meshsfee += primCreationCost;
|
||||
}
|
||||
|
||||
if (skipedSmall > 0)
|
||||
{
|
||||
if (skipedSmall > numberInstances / 2)
|
||||
{
|
||||
error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() +
|
||||
"m minimum allowed size. Please check scalling";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
warning += skipedSmall.ToString() + " of the requested " +numberInstances.ToString() +
|
||||
" model prims will not upload because they are smaller than " + PrimScaleMin.ToString() +
|
||||
"m minimum allowed size. Please check scalling ";
|
||||
}
|
||||
|
||||
if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost)
|
||||
meshcostdata.resource_cost = meshcostdata.model_streaming_cost;
|
||||
else
|
||||
meshcostdata.resource_cost = meshcostdata.physics_cost;
|
||||
|
||||
if (meshcostdata.resource_cost < meshcostdata.simulation_cost)
|
||||
meshcostdata.resource_cost = meshcostdata.simulation_cost;
|
||||
|
||||
// scale cost
|
||||
// at this point a cost of 1.0 whould mean basic cost
|
||||
meshsfee *= ModelMeshCostFactor;
|
||||
|
||||
if (meshsfee < ModelMinCostFactor)
|
||||
meshsfee = ModelMinCostFactor;
|
||||
|
||||
// actually scale it to basic cost
|
||||
meshsfee *= (float)basicCost;
|
||||
|
||||
meshsfee += 0.5f; // rounding
|
||||
|
||||
totalcost += (int)meshsfee;
|
||||
|
||||
// breakdown prices
|
||||
// don't seem to be in use so removed code for now
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// single mesh asset cost
|
||||
private bool MeshCost(byte[] data, ameshCostParam cost, out string error)
|
||||
{
|
||||
cost.highLODSize = 0;
|
||||
cost.medLODSize = 0;
|
||||
cost.lowLODSize = 0;
|
||||
cost.lowestLODSize = 0;
|
||||
cost.physicsCost = 0.0f;
|
||||
cost.costFee = 0.0f;
|
||||
|
||||
error = string.Empty;
|
||||
|
||||
if (data == null || data.Length == 0)
|
||||
{
|
||||
error = "Missing model information.";
|
||||
return false;
|
||||
}
|
||||
|
||||
OSD meshOsd = null;
|
||||
int start = 0;
|
||||
|
||||
error = "Invalid model data";
|
||||
|
||||
using (MemoryStream ms = new MemoryStream(data))
|
||||
{
|
||||
try
|
||||
{
|
||||
OSD osd = OSDParser.DeserializeLLSDBinary(ms);
|
||||
if (osd is OSDMap)
|
||||
meshOsd = (OSDMap)osd;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
start = (int)ms.Position;
|
||||
}
|
||||
|
||||
OSDMap map = (OSDMap)meshOsd;
|
||||
OSDMap tmpmap;
|
||||
|
||||
int highlod_size = 0;
|
||||
int medlod_size = 0;
|
||||
int lowlod_size = 0;
|
||||
int lowestlod_size = 0;
|
||||
int skin_size = 0;
|
||||
|
||||
int hulls_size = 0;
|
||||
int phys_nhulls;
|
||||
int phys_hullsvertices = 0;
|
||||
|
||||
int physmesh_size = 0;
|
||||
int phys_ntriangles = 0;
|
||||
|
||||
int submesh_offset = -1;
|
||||
|
||||
if (map.ContainsKey("physics_convex"))
|
||||
{
|
||||
tmpmap = (OSDMap)map["physics_convex"];
|
||||
if (tmpmap.ContainsKey("offset"))
|
||||
submesh_offset = tmpmap["offset"].AsInteger() + start;
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
hulls_size = tmpmap["size"].AsInteger();
|
||||
}
|
||||
|
||||
if (submesh_offset < 0 || hulls_size == 0)
|
||||
{
|
||||
error = "Missing physics_convex block";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls))
|
||||
{
|
||||
error = "Bad physics_convex block";
|
||||
return false;
|
||||
}
|
||||
|
||||
submesh_offset = -1;
|
||||
|
||||
// only look for LOD meshs sizes
|
||||
|
||||
if (map.ContainsKey("high_lod"))
|
||||
{
|
||||
tmpmap = (OSDMap)map["high_lod"];
|
||||
// see at least if there is a offset for this one
|
||||
if (tmpmap.ContainsKey("offset"))
|
||||
submesh_offset = tmpmap["offset"].AsInteger() + start;
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
highlod_size = tmpmap["size"].AsInteger();
|
||||
}
|
||||
|
||||
if (submesh_offset < 0 || highlod_size <= 0)
|
||||
{
|
||||
error = "Missing high_lod block";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool haveprev = true;
|
||||
|
||||
if (map.ContainsKey("medium_lod"))
|
||||
{
|
||||
tmpmap = (OSDMap)map["medium_lod"];
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
medlod_size = tmpmap["size"].AsInteger();
|
||||
else
|
||||
haveprev = false;
|
||||
}
|
||||
|
||||
if (haveprev && map.ContainsKey("low_lod"))
|
||||
{
|
||||
tmpmap = (OSDMap)map["low_lod"];
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
lowlod_size = tmpmap["size"].AsInteger();
|
||||
else
|
||||
haveprev = false;
|
||||
}
|
||||
|
||||
if (haveprev && map.ContainsKey("lowest_lod"))
|
||||
{
|
||||
tmpmap = (OSDMap)map["lowest_lod"];
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
lowestlod_size = tmpmap["size"].AsInteger();
|
||||
}
|
||||
|
||||
if (map.ContainsKey("skin"))
|
||||
{
|
||||
tmpmap = (OSDMap)map["skin"];
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
skin_size = tmpmap["size"].AsInteger();
|
||||
}
|
||||
|
||||
cost.highLODSize = highlod_size;
|
||||
cost.medLODSize = medlod_size;
|
||||
cost.lowLODSize = lowlod_size;
|
||||
cost.lowestLODSize = lowestlod_size;
|
||||
|
||||
submesh_offset = -1;
|
||||
|
||||
tmpmap = null;
|
||||
if(map.ContainsKey("physics_mesh"))
|
||||
tmpmap = (OSDMap)map["physics_mesh"];
|
||||
else if (map.ContainsKey("physics_shape")) // old naming
|
||||
tmpmap = (OSDMap)map["physics_shape"];
|
||||
|
||||
if(tmpmap != null)
|
||||
{
|
||||
if (tmpmap.ContainsKey("offset"))
|
||||
submesh_offset = tmpmap["offset"].AsInteger() + start;
|
||||
if (tmpmap.ContainsKey("size"))
|
||||
physmesh_size = tmpmap["size"].AsInteger();
|
||||
|
||||
if (submesh_offset >= 0 || physmesh_size > 0)
|
||||
{
|
||||
|
||||
if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles))
|
||||
{
|
||||
error = "Model data parsing error";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// upload is done in convex shape type so only one hull
|
||||
phys_hullsvertices++;
|
||||
cost.physicsCost = 0.04f * phys_hullsvertices;
|
||||
|
||||
float sfee;
|
||||
|
||||
sfee = data.Length; // start with total compressed data size
|
||||
|
||||
// penalize lod meshs that should be more builder optimized
|
||||
sfee += medSizeWth * medlod_size;
|
||||
sfee += lowSizeWth * lowlod_size;
|
||||
sfee += lowestSizeWth * lowlod_size;
|
||||
|
||||
// physics
|
||||
// favor potencial optimized meshs versus automatic decomposition
|
||||
if (physmesh_size != 0)
|
||||
sfee += physMeshSizeWth * (physmesh_size + hulls_size / 4); // reduce cost of mandatory convex hull
|
||||
else
|
||||
sfee += physHullSizeWth * hulls_size;
|
||||
|
||||
// bytes to money
|
||||
sfee *= bytecost;
|
||||
|
||||
cost.costFee = sfee;
|
||||
return true;
|
||||
}
|
||||
|
||||
// parses a LOD or physics mesh component
|
||||
private bool submesh(byte[] data, int offset, int size, out int ntriangles)
|
||||
{
|
||||
ntriangles = 0;
|
||||
|
||||
OSD decodedMeshOsd = new OSD();
|
||||
byte[] meshBytes = new byte[size];
|
||||
System.Buffer.BlockCopy(data, offset, meshBytes, 0, size);
|
||||
try
|
||||
{
|
||||
using (MemoryStream inMs = new MemoryStream(meshBytes))
|
||||
{
|
||||
using (MemoryStream outMs = new MemoryStream())
|
||||
{
|
||||
using (ZOutputStream zOut = new ZOutputStream(outMs))
|
||||
{
|
||||
byte[] readBuffer = new byte[4096];
|
||||
int readLen = 0;
|
||||
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
|
||||
{
|
||||
zOut.Write(readBuffer, 0, readLen);
|
||||
}
|
||||
zOut.Flush();
|
||||
outMs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] decompressedBuf = outMs.GetBuffer();
|
||||
decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDArray decodedMeshOsdArray = null;
|
||||
if ((!decodedMeshOsd is OSDArray))
|
||||
return false;
|
||||
|
||||
byte[] dummy;
|
||||
|
||||
decodedMeshOsdArray = (OSDArray)decodedMeshOsd;
|
||||
foreach (OSD subMeshOsd in decodedMeshOsdArray)
|
||||
{
|
||||
if (subMeshOsd is OSDMap)
|
||||
{
|
||||
OSDMap subtmpmap = (OSDMap)subMeshOsd;
|
||||
if (subtmpmap.ContainsKey("NoGeometry") && ((OSDBoolean)subtmpmap["NoGeometry"]))
|
||||
continue;
|
||||
|
||||
if (!subtmpmap.ContainsKey("Position"))
|
||||
return false;
|
||||
|
||||
if (subtmpmap.ContainsKey("TriangleList"))
|
||||
{
|
||||
dummy = subtmpmap["TriangleList"].AsBinary();
|
||||
ntriangles += dummy.Length / bytesPerCoord;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// parses convex hulls component
|
||||
private bool hulls(byte[] data, int offset, int size, out int nvertices, out int nhulls)
|
||||
{
|
||||
nvertices = 0;
|
||||
nhulls = 1;
|
||||
|
||||
OSD decodedMeshOsd = new OSD();
|
||||
byte[] meshBytes = new byte[size];
|
||||
System.Buffer.BlockCopy(data, offset, meshBytes, 0, size);
|
||||
try
|
||||
{
|
||||
using (MemoryStream inMs = new MemoryStream(meshBytes))
|
||||
{
|
||||
using (MemoryStream outMs = new MemoryStream())
|
||||
{
|
||||
using (ZOutputStream zOut = new ZOutputStream(outMs))
|
||||
{
|
||||
byte[] readBuffer = new byte[4096];
|
||||
int readLen = 0;
|
||||
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
|
||||
{
|
||||
zOut.Write(readBuffer, 0, readLen);
|
||||
}
|
||||
zOut.Flush();
|
||||
outMs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] decompressedBuf = outMs.GetBuffer();
|
||||
decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDMap cmap = (OSDMap)decodedMeshOsd;
|
||||
if (cmap == null)
|
||||
return false;
|
||||
|
||||
byte[] dummy;
|
||||
|
||||
// must have one of this
|
||||
if (cmap.ContainsKey("BoundingVerts"))
|
||||
{
|
||||
dummy = cmap["BoundingVerts"].AsBinary();
|
||||
nvertices = dummy.Length / bytesPerCoord;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
/* upload is done with convex shape type
|
||||
if (cmap.ContainsKey("HullList"))
|
||||
{
|
||||
dummy = cmap["HullList"].AsBinary();
|
||||
nhulls += dummy.Length;
|
||||
}
|
||||
|
||||
|
||||
if (cmap.ContainsKey("Positions"))
|
||||
{
|
||||
dummy = cmap["Positions"].AsBinary();
|
||||
nvertices = dummy.Length / bytesPerCoord;
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns streaming cost from on mesh LODs sizes in curCost and square of prim size length
|
||||
private float streamingCost(ameshCostParam curCost, float sqdiam)
|
||||
{
|
||||
// compute efective areas
|
||||
float ma = 262144f;
|
||||
|
||||
float mh = sqdiam * highLodFactor;
|
||||
if (mh > ma)
|
||||
mh = ma;
|
||||
float mm = sqdiam * midLodFactor;
|
||||
if (mm > ma)
|
||||
mm = ma;
|
||||
|
||||
float ml = sqdiam * lowLodFactor;
|
||||
if (ml > ma)
|
||||
ml = ma;
|
||||
|
||||
float mlst = ma;
|
||||
|
||||
mlst -= ml;
|
||||
ml -= mm;
|
||||
mm -= mh;
|
||||
|
||||
if (mlst < 1.0f)
|
||||
mlst = 1.0f;
|
||||
if (ml < 1.0f)
|
||||
ml = 1.0f;
|
||||
if (mm < 1.0f)
|
||||
mm = 1.0f;
|
||||
if (mh < 1.0f)
|
||||
mh = 1.0f;
|
||||
|
||||
ma = mlst + ml + mm + mh;
|
||||
|
||||
// get LODs compressed sizes
|
||||
// giving 384 bytes bonus
|
||||
int lst = curCost.lowestLODSize - 384;
|
||||
int l = curCost.lowLODSize - 384;
|
||||
int m = curCost.medLODSize - 384;
|
||||
int h = curCost.highLODSize - 384;
|
||||
|
||||
// use previus higher LOD size on missing ones
|
||||
if (m <= 0)
|
||||
m = h;
|
||||
if (l <= 0)
|
||||
l = m;
|
||||
if (lst <= 0)
|
||||
lst = l;
|
||||
|
||||
// force minumum sizes
|
||||
if (lst < 16)
|
||||
lst = 16;
|
||||
if (l < 16)
|
||||
l = 16;
|
||||
if (m < 16)
|
||||
m = 16;
|
||||
if (h < 16)
|
||||
h = 16;
|
||||
|
||||
// compute cost weighted by relative effective areas
|
||||
float cost = (float)lst * mlst + (float)l * ml + (float)m * mm + (float)h * mh;
|
||||
cost /= ma;
|
||||
|
||||
cost *= 0.004f; // overall tunning parameter
|
||||
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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}",
|
||||
@@ -419,7 +419,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
}
|
||||
|
||||
public Hashtable GetEvents(UUID requestID, UUID pAgentId)
|
||||
public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
|
||||
{
|
||||
if (DebugLevel >= 2)
|
||||
m_log.DebugFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName);
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,12 +151,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
|
||||
uint locationID, uint flags, string capsURL, UUID agentID)
|
||||
{
|
||||
// not sure why flags get overwritten here
|
||||
if ((flags & (uint)TeleportFlags.IsFlying) != 0)
|
||||
flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying;
|
||||
else
|
||||
flags = (uint)TeleportFlags.ViaLocation;
|
||||
|
||||
OSDMap info = new OSDMap();
|
||||
info.Add("AgentID", OSD.FromUUID(agentID));
|
||||
info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this?
|
||||
@@ -165,8 +159,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
info.Add("SimAccess", OSD.FromInteger(simAccess));
|
||||
info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
|
||||
info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
|
||||
// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
|
||||
info.Add("TeleportFlags", OSD.FromUInteger(flags));
|
||||
info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
|
||||
|
||||
OSDArray infoArr = new OSDArray();
|
||||
infoArr.Add(info);
|
||||
@@ -402,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));
|
||||
|
||||
@@ -27,13 +27,18 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
@@ -42,81 +47,64 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This module implements both WebFetchTextureDescendents and FetchTextureDescendents2 capabilities.
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")]
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetTextureModule : INonSharedRegionModule
|
||||
{
|
||||
|
||||
struct aPollRequest
|
||||
{
|
||||
public PollServiceTextureEventArgs thepoll;
|
||||
public UUID reqID;
|
||||
public Hashtable request;
|
||||
}
|
||||
|
||||
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 IAssetService m_assetService;
|
||||
|
||||
private static GetTextureHandler m_getTextureHandler;
|
||||
private bool m_Enabled = false;
|
||||
|
||||
private IAssetService m_assetService = null;
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||
private static Thread[] m_workerThreads = null;
|
||||
|
||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||
private string m_URL;
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_URL = config.GetString("Cap_GetTexture", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = s;
|
||||
m_assetService = s.AssetService;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// We'll reuse the same handler for all requests.
|
||||
m_getTextureHandler = new GetTextureHandler(m_assetService);
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||
|
||||
if (m_workerThreads == null)
|
||||
{
|
||||
m_workerThreads = new Thread[4];
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests,
|
||||
String.Format("TextureWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -134,152 +122,24 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#endregion
|
||||
|
||||
~GetTextureModule()
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
}
|
||||
|
||||
private class PollServiceTextureEventArgs : PollServiceEventArgs
|
||||
{
|
||||
private List<Hashtable> requests =
|
||||
new List<Hashtable>();
|
||||
private Dictionary<UUID, Hashtable> responses =
|
||||
new Dictionary<UUID, Hashtable>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
public PollServiceTextureEventArgs(UUID pId, Scene scene) :
|
||||
base(null, null, null, null, pId, int.MaxValue)
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
HasEvents = (x, y) =>
|
||||
{
|
||||
lock (responses)
|
||||
return responses.ContainsKey(x);
|
||||
};
|
||||
GetEvents = (x, y) =>
|
||||
{
|
||||
lock (responses)
|
||||
{
|
||||
try
|
||||
{
|
||||
return responses[x];
|
||||
}
|
||||
finally
|
||||
{
|
||||
responses.Remove(x);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Request = (x, y) =>
|
||||
{
|
||||
aPollRequest reqinfo = new aPollRequest();
|
||||
reqinfo.thepoll = this;
|
||||
reqinfo.reqID = x;
|
||||
reqinfo.request = y;
|
||||
|
||||
m_queue.Enqueue(reqinfo);
|
||||
};
|
||||
|
||||
// this should never happen except possible on shutdown
|
||||
NoEvents = (x, y) =>
|
||||
{
|
||||
/*
|
||||
lock (requests)
|
||||
{
|
||||
Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString());
|
||||
requests.Remove(request);
|
||||
}
|
||||
*/
|
||||
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;
|
||||
};
|
||||
// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler(
|
||||
"GetTexture",
|
||||
new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString()));
|
||||
}
|
||||
|
||||
public void Process(aPollRequest requestinfo)
|
||||
else
|
||||
{
|
||||
Hashtable response;
|
||||
|
||||
UUID requestID = requestinfo.reqID;
|
||||
|
||||
// If the avatar is gone, don't bother to get the texture
|
||||
if (m_scene.GetScenePresence(Id) == null)
|
||||
{
|
||||
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;
|
||||
|
||||
lock (responses)
|
||||
responses[requestID] = response;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
response = m_getTextureHandler.Handle(requestinfo.request);
|
||||
lock (responses)
|
||||
responses[requestID] = response;
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl = "/CAPS/" + UUID.Random() + "/";
|
||||
|
||||
// Register this as a poll service
|
||||
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
|
||||
|
||||
args.Type = PollServiceEventArgs.EventType.Texture;
|
||||
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("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||
|
||||
m_capsDict[agentID] = capUrl;
|
||||
}
|
||||
|
||||
private void DeregisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl;
|
||||
|
||||
if (m_capsDict.TryGetValue(agentID, out capUrl))
|
||||
{
|
||||
MainServer.Instance.RemoveHTTPHandler("", capUrl);
|
||||
m_capsDict.Remove(agentID);
|
||||
}
|
||||
}
|
||||
|
||||
private void DoTextureRequests()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,15 +129,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
|
||||
|
||||
OSDMap data = new OSDMap();
|
||||
// ScenePresence sp = m_scene.GetScenePresence(m_agentID);
|
||||
// data["username"] = sp.Firstname + "." + sp.Lastname;
|
||||
// data["display_name_next_update"] = new OSDDate(DateTime.Now);
|
||||
// data["legacy_first_name"] = sp.Firstname;
|
||||
ScenePresence sp = m_scene.GetScenePresence(m_agentID);
|
||||
data["username"] = sp.Firstname + "." + sp.Lastname;
|
||||
data["display_name_next_update"] = new OSDDate(DateTime.Now);
|
||||
data["legacy_first_name"] = sp.Firstname;
|
||||
data["mesh_upload_status"] = "valid";
|
||||
// data["display_name"] = sp.Firstname + " " + sp.Lastname;
|
||||
// data["legacy_last_name"] = sp.Lastname;
|
||||
// data["id"] = m_agentID;
|
||||
// data["is_display_name_default"] = true;
|
||||
data["display_name"] = sp.Firstname + " " + sp.Lastname;
|
||||
data["legacy_last_name"] = sp.Lastname;
|
||||
data["id"] = m_agentID;
|
||||
data["is_display_name_default"] = true;
|
||||
|
||||
//Send back data
|
||||
Hashtable responsedata = new Hashtable();
|
||||
|
||||
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* 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 System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
// private IAssetService m_assetService;
|
||||
private bool m_dumpAssetsToFile = false;
|
||||
private bool m_enabled = true;
|
||||
private int m_levelUpload = 0;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig meshConfig = source.Configs["Mesh"];
|
||||
if (meshConfig == null)
|
||||
return;
|
||||
|
||||
m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true);
|
||||
m_levelUpload = meshConfig.GetInt("LevelUpload", 0);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
{
|
||||
m_scene = pScene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
// m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } }
|
||||
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
if(!m_enabled)
|
||||
return;
|
||||
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID);
|
||||
caps.RegisterHandler(
|
||||
"NewFileAgentInventoryVariablePrice",
|
||||
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>(
|
||||
"POST",
|
||||
"/CAPS/" + capID.ToString(),
|
||||
req => NewAgentInventoryRequest(req, agentID),
|
||||
"NewFileAgentInventoryVariablePrice",
|
||||
agentID.ToString()));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID)
|
||||
{
|
||||
//TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit
|
||||
// you need to be aware of this
|
||||
|
||||
//if (llsdRequest.asset_type == "texture" ||
|
||||
// llsdRequest.asset_type == "animation" ||
|
||||
// llsdRequest.asset_type == "sound")
|
||||
// {
|
||||
// check user level
|
||||
|
||||
ScenePresence avatar = null;
|
||||
IClientAPI client = null;
|
||||
m_scene.TryGetScenePresence(agentID, out avatar);
|
||||
|
||||
if (avatar != null)
|
||||
{
|
||||
client = avatar.ControllingClient;
|
||||
|
||||
if (avatar.UserLevel < m_levelUpload)
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false);
|
||||
|
||||
LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
|
||||
errorResponse.rsvp = "";
|
||||
errorResponse.state = "error";
|
||||
return errorResponse;
|
||||
}
|
||||
}
|
||||
|
||||
// check funds
|
||||
IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(agentID, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
|
||||
LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
|
||||
errorResponse.rsvp = "";
|
||||
errorResponse.state = "error";
|
||||
return errorResponse;
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
string assetName = llsdRequest.name;
|
||||
string assetDes = llsdRequest.description;
|
||||
string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/";
|
||||
UUID newAsset = UUID.Random();
|
||||
UUID newInvItem = UUID.Random();
|
||||
UUID parentFolder = llsdRequest.folder_id;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/";
|
||||
|
||||
AssetUploader uploader =
|
||||
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||
llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile);
|
||||
|
||||
MainServer.Instance.AddStreamHandler(
|
||||
new BinaryStreamHandler(
|
||||
"POST",
|
||||
capsBase + uploaderPath,
|
||||
uploader.uploaderCaps,
|
||||
"NewFileAgentInventoryVariablePrice",
|
||||
agentID.ToString()));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (MainServer.Instance.UseSSL)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
|
||||
|
||||
LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
|
||||
|
||||
uploadResponse.rsvp = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
uploadResponse.resource_cost = 0;
|
||||
uploadResponse.upload_price = 0;
|
||||
|
||||
uploader.OnUpLoad += //UploadCompleteHandler;
|
||||
|
||||
delegate(
|
||||
string passetName, string passetDescription, UUID passetID,
|
||||
UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType,
|
||||
string passetType)
|
||||
{
|
||||
UploadCompleteHandler(passetName, passetDescription, passetID,
|
||||
pinventoryItem, pparentFolder, pdata, pinventoryType,
|
||||
passetType,agentID);
|
||||
};
|
||||
|
||||
return uploadResponse;
|
||||
}
|
||||
|
||||
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType,UUID AgentID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem);
|
||||
|
||||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
if (inventoryType == "sound")
|
||||
{
|
||||
inType = 1;
|
||||
assType = 1;
|
||||
}
|
||||
else if (inventoryType == "animation")
|
||||
{
|
||||
inType = 19;
|
||||
assType = 20;
|
||||
}
|
||||
else if (inventoryType == "wearable")
|
||||
{
|
||||
inType = 18;
|
||||
switch (assetType)
|
||||
{
|
||||
case "bodypart":
|
||||
assType = 13;
|
||||
break;
|
||||
case "clothing":
|
||||
assType = 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (inventoryType == "mesh")
|
||||
{
|
||||
inType = (sbyte)InventoryType.Mesh;
|
||||
assType = (sbyte)AssetType.Mesh;
|
||||
}
|
||||
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, assetName, assType, AgentID.ToString());
|
||||
asset.Data = data;
|
||||
|
||||
if (m_scene.AssetService != null)
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = AgentID;
|
||||
item.CreatorId = AgentID.ToString();
|
||||
item.ID = inventoryItem;
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = assetDescription;
|
||||
item.Name = assetName;
|
||||
item.AssetType = assType;
|
||||
item.InvType = inType;
|
||||
item.Folder = parentFolder;
|
||||
item.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_scene.AddInventoryItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,22 +27,18 @@
|
||||
|
||||
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;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
@@ -52,72 +48,67 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class WebFetchInvDescModule : INonSharedRegionModule
|
||||
{
|
||||
struct aPollRequest
|
||||
{
|
||||
public PollServiceInventoryEventArgs thepoll;
|
||||
public UUID reqID;
|
||||
public Hashtable request;
|
||||
}
|
||||
|
||||
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 static WebFetchInvDescHandler m_webFetchHandler;
|
||||
private bool m_Enabled;
|
||||
|
||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||
private static Thread[] m_workerThreads = null;
|
||||
private string m_fetchInventoryDescendents2Url;
|
||||
private string m_webFetchInventoryDescendentsUrl;
|
||||
|
||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||
private WebFetchInvDescHandler m_webFetchHandler;
|
||||
|
||||
#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;
|
||||
|
||||
if (m_workerThreads == null)
|
||||
{
|
||||
m_workerThreads = new Thread[2];
|
||||
|
||||
for (uint i = 0; i < 2; i++)
|
||||
{
|
||||
m_workerThreads[i] = Watchdog.StartThread(DoInventoryRequests,
|
||||
String.Format("InventoryWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -135,130 +126,43 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#endregion
|
||||
|
||||
~WebFetchInvDescModule()
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
}
|
||||
|
||||
private class PollServiceInventoryEventArgs : PollServiceEventArgs
|
||||
{
|
||||
private Dictionary<UUID, Hashtable> responses =
|
||||
new Dictionary<UUID, Hashtable>();
|
||||
|
||||
public PollServiceInventoryEventArgs(UUID pId) :
|
||||
base(null, null, null, null, pId, int.MaxValue)
|
||||
{
|
||||
HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
|
||||
GetEvents = (x, y) =>
|
||||
{
|
||||
lock (responses)
|
||||
{
|
||||
try
|
||||
{
|
||||
return responses[x];
|
||||
}
|
||||
finally
|
||||
{
|
||||
responses.Remove(x);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Request = (x, y) =>
|
||||
{
|
||||
aPollRequest reqinfo = new aPollRequest();
|
||||
reqinfo.thepoll = this;
|
||||
reqinfo.reqID = x;
|
||||
reqinfo.request = y;
|
||||
|
||||
m_queue.Enqueue(reqinfo);
|
||||
};
|
||||
|
||||
NoEvents = (x, y) =>
|
||||
{
|
||||
/*
|
||||
lock (requests)
|
||||
{
|
||||
Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString());
|
||||
requests.Remove(request);
|
||||
}
|
||||
*/
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
public void Process(aPollRequest requestinfo)
|
||||
{
|
||||
UUID requestID = requestinfo.reqID;
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
|
||||
response["int_response_code"] = 200;
|
||||
response["content_type"] = "text/plain";
|
||||
response["keepalive"] = false;
|
||||
response["reusecontext"] = false;
|
||||
|
||||
response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(
|
||||
requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
|
||||
|
||||
lock (responses)
|
||||
responses[requestID] = response;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID);
|
||||
|
||||
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();
|
||||
|
||||
private void DoInventoryRequests()
|
||||
{
|
||||
while (true)
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler(
|
||||
"POST",
|
||||
capUrl,
|
||||
m_webFetchHandler.FetchInventoryDescendentsRequest,
|
||||
"FetchInventoryDescendents2",
|
||||
agentID.ToString());
|
||||
|
||||
caps.RegisterHandler(capName, reqHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
capUrl = url;
|
||||
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
caps.RegisterHandler(capName, capUrl);
|
||||
}
|
||||
|
||||
// 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,12 +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));
|
||||
packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet));
|
||||
}
|
||||
|
||||
#region BinaryStats
|
||||
@@ -1049,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
|
||||
{
|
||||
@@ -1082,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(
|
||||
@@ -1202,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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,7 +1148,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
while (base.IsRunning)
|
||||
{
|
||||
m_scene.ThreadAlive(1);
|
||||
try
|
||||
{
|
||||
IncomingPacket incomingPacket = null;
|
||||
@@ -1257,7 +1190,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
while (base.IsRunning)
|
||||
{
|
||||
m_scene.ThreadAlive(2);
|
||||
try
|
||||
{
|
||||
m_packetSent = false;
|
||||
@@ -1479,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
|
||||
@@ -1507,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)
|
||||
@@ -1523,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,
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
}
|
||||
|
||||
public bool RequestCreateInventoryItem(IClientAPI remoteClient,
|
||||
public void RequestCreateInventoryItem(IClientAPI remoteClient,
|
||||
UUID transactionID, UUID folderID, uint callbackID,
|
||||
string description, string name, sbyte invType,
|
||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
@@ -160,16 +160,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
|
||||
if (uploader != null)
|
||||
{
|
||||
uploader.RequestCreateInventoryItem(
|
||||
remoteClient, transactionID, folderID,
|
||||
callbackID, description, name, invType, type,
|
||||
wearableType, nextOwnerMask);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to create inventory item {1} from {2}",
|
||||
transactionID, name, remoteClient.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
/// <param name="type"></param>
|
||||
/// <param name="wearableType"></param>
|
||||
/// <param name="nextOwnerMask"></param>
|
||||
public bool HandleItemCreationFromTransaction(IClientAPI remoteClient,
|
||||
public void HandleItemCreationFromTransaction(IClientAPI remoteClient,
|
||||
UUID transactionID, UUID folderID, uint callbackID,
|
||||
string description, string name, sbyte invType,
|
||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
AgentAssetTransactions transactions =
|
||||
GetUserTransactions(remoteClient.AgentId);
|
||||
|
||||
return transactions.RequestCreateInventoryItem(remoteClient, transactionID,
|
||||
transactions.RequestCreateInventoryItem(remoteClient, transactionID,
|
||||
folderID, callbackID, description, name, invType, type,
|
||||
wearableType, nextOwnerMask);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -525,7 +525,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
{
|
||||
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
|
||||
{
|
||||
for (int j = 0; j < appearance.Wearables[i].Count; j++)
|
||||
for (int j = 0; j < appearance.Wearables[j].Count; j++)
|
||||
{
|
||||
if (appearance.Wearables[i][j].ItemID == UUID.Zero)
|
||||
continue;
|
||||
@@ -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,86 +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.MakeChildAgent();
|
||||
sp.ControllingClient.Close();
|
||||
}
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user