Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-09-14 22:03:42 +01:00
commit 1212cb0c74
16 changed files with 1414 additions and 68 deletions

View File

@ -37,6 +37,7 @@ using log4net;
using log4net.Appender; using log4net.Appender;
using log4net.Core; using log4net.Core;
using log4net.Repository; using log4net.Repository;
using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
@ -234,26 +235,19 @@ namespace OpenSim.Framework.Servers
protected string GetThreadsReport() protected string GetThreadsReport()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
ProcessThreadCollection threads = ThreadTracker.GetThreads(); sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
if (threads == null) foreach (Watchdog.ThreadWatchdogInfo twi in threads)
{ {
sb.Append("OpenSim thread tracking is only enabled in DEBUG mode."); Thread t = twi.Thread;
}
else sb.Append(
{ "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", TimeRunning: "
sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine); + "Pri: " + t.Priority + ", State: " + t.ThreadState);
foreach (ProcessThread t in threads)
{
sb.Append("ID: " + t.Id + ", TotalProcessorTime: " + t.TotalProcessorTime + ", TimeRunning: " +
(DateTime.Now - t.StartTime) + ", Pri: " + t.CurrentPriority + ", State: " + t.ThreadState);
if (t.ThreadState == System.Diagnostics.ThreadState.Wait)
sb.Append(", Reason: " + t.WaitReason + Environment.NewLine);
else
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
}
}
}
int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0;
ThreadPool.GetAvailableThreads(out workers, out ports); ThreadPool.GetAvailableThreads(out workers, out ports);
ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts); ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -27,6 +27,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
using log4net; using log4net;
@ -43,7 +44,7 @@ namespace OpenSim.Framework
const int WATCHDOG_TIMEOUT_MS = 5000; const int WATCHDOG_TIMEOUT_MS = 5000;
[System.Diagnostics.DebuggerDisplay("{Thread.Name}")] [System.Diagnostics.DebuggerDisplay("{Thread.Name}")]
private class ThreadWatchdogInfo public class ThreadWatchdogInfo
{ {
public Thread Thread; public Thread Thread;
public int LastTick; public int LastTick;
@ -150,6 +151,15 @@ namespace OpenSim.Framework
catch { } catch { }
} }
/// <summary>
/// Get currently watched threads for diagnostic purposes
/// </summary>
/// <returns></returns>
public static ThreadWatchdogInfo[] GetThreads()
{
return m_threads.Values.ToArray();
}
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
WatchdogTimeout callback = OnWatchdogTimeout; WatchdogTimeout callback = OnWatchdogTimeout;

View File

@ -5222,11 +5222,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[GENERICMESSAGE] " + e); m_log.ErrorFormat(
"[LLCLIENTVIEW]: Exeception when handling generic message {0}{1}", e.Message, e.StackTrace);
} }
} }
} }
m_log.Error("[GENERICMESSAGE] Not handling GenericMessage with method-type of: " + method);
//m_log.Debug("[LLCLIENTVIEW]: Not handling GenericMessage with method-type of: " + method);
return false; return false;
} }

View File

@ -695,9 +695,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet.Header.Reliable && !udpClient.PacketArchive.TryEnqueue(packet.Header.Sequence)) if (packet.Header.Reliable && !udpClient.PacketArchive.TryEnqueue(packet.Header.Sequence))
{ {
if (packet.Header.Resent) if (packet.Header.Resent)
m_log.Debug("[LLUDPSERVER]: Received a resend of already processed packet #" + packet.Header.Sequence + ", type: " + packet.Type); m_log.DebugFormat(
"[LLUDPSERVER]: Received a resend of already processed packet #{0}, type {1} from {2}",
packet.Header.Sequence, packet.Type, client.Name);
else else
m_log.Warn("[LLUDPSERVER]: Received a duplicate (not marked as resend) of packet #" + packet.Header.Sequence + ", type: " + packet.Type); m_log.WarnFormat(
"[LLUDPSERVER]: Received a duplicate (not marked as resend) of packet #{0}, type {1} from {2}",
packet.Header.Sequence, packet.Type, client.Name);
// Avoid firing a callback twice for the same packet // Avoid firing a callback twice for the same packet
return; return;

View File

@ -187,18 +187,20 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
int start, end; int start, end;
if (TryParseRange(range, out start, out end)) if (TryParseRange(range, out start, out end))
{ {
end = Utils.Clamp(end, 1, texture.Data.Length); end = Utils.Clamp(end, 1, texture.Data.Length - 1);
start = Utils.Clamp(start, 0, end - 1); start = Utils.Clamp(start, 0, end - 1);
int len = end - start + 1;
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
if (end - start < texture.Data.Length) if (len < texture.Data.Length)
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
response.ContentLength = end - start; response.ContentLength = len;
response.ContentType = texture.Metadata.ContentType; 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, end - start); response.Body.Write(texture.Data, start, len);
} }
else else
{ {

View File

@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
itemID = group.GetFromItemID(); itemID = group.GetFromItemID();
} }
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
AttachToAgent(sp, group, AttachmentPt, attachPos, silent); AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
} }
@ -219,8 +219,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{ {
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
} }
@ -238,11 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (updateInventoryStatus) if (updateInventoryStatus)
{ {
if (att == null) if (att == null)
{
ShowDetachInUserInventory(itemID, remoteClient); ShowDetachInUserInventory(itemID, remoteClient);
} else
ShowAttachInUserInventory(att, remoteClient, itemID, AttachmentPt);
SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
} }
if (null == att) if (null == att)
@ -313,12 +309,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return null; return null;
} }
public UUID SetAttachmentInventoryStatus( /// <summary>
/// Update the user inventory to the attachment of an item
/// </summary>
/// <param name="att"></param>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
protected UUID ShowAttachInUserInventory(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{ {
m_log.DebugFormat( // m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", // "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
remoteClient.Name, att.Name, itemID); // remoteClient.Name, att.Name, itemID);
if (!att.IsDeleted) if (!att.IsDeleted)
AttachmentPt = att.RootPart.AttachmentPoint; AttachmentPt = att.RootPart.AttachmentPoint;
@ -343,7 +347,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <param name="AttachmentPt"></param> /// <param name="AttachmentPt"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
/// <param name="att"></param> /// <param name="att"></param>
public void SetAttachmentInventoryStatus( protected void ShowAttachInUserInventory(
IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -407,7 +411,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// Save avatar attachment information // Save avatar attachment information
if (m_scene.AvatarFactory != null) if (m_scene.AvatarFactory != null)
{ {
m_log.Debug("[ATTACHMENTS MODULE]: Dettaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
} }
} }

View File

@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public void UpdateDatabase(UUID user, AvatarAppearance appearance) public void UpdateDatabase(UUID user, AvatarAppearance appearance)
{ {
m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase");
AvatarData adata = new AvatarData(appearance); AvatarData adata = new AvatarData(appearance);
m_scene.AvatarService.SetAvatar(user, adata); m_scene.AvatarService.SetAvatar(user, adata);
} }

View File

@ -115,17 +115,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient); void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient);
/// <summary>
/// Update the user inventory to the attachment of an item
/// </summary>
/// <param name="att"></param>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
UUID SetAttachmentInventoryStatus(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
/// <summary> /// <summary>
/// Update the user inventory to show a detach. /// Update the user inventory to show a detach.
/// </summary> /// </summary>

View File

@ -1348,11 +1348,15 @@ namespace OpenSim.Region.Framework.Scenes
if (m_frame % m_update_presences == 0) if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences(); m_sceneGraph.UpdatePresences();
<<<<<<< HEAD:OpenSim/Region/Framework/Scenes/Scene.cs
// Update SceneObjectGroups that have scheduled themselves for updates // Update SceneObjectGroups that have scheduled themselves for updates
// Objects queue their updates onto all scene presences // Objects queue their updates onto all scene presences
if (m_frame % m_update_objects == 0) if (m_frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups(); m_sceneGraph.UpdateObjectGroups();
=======
// Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
>>>>>>> master:OpenSim/Region/Framework/Scenes/Scene.cs
if (m_frame % m_update_coarse_locations == 0) if (m_frame % m_update_coarse_locations == 0)
{ {
List<Vector3> coarseLocations; List<Vector3> coarseLocations;
@ -1370,9 +1374,12 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.UpdatePreparePhysics(); m_sceneGraph.UpdatePreparePhysics();
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
// Apply any pending avatar force input to the avatar's velocity
if (m_frame % m_update_entitymovement == 0) if (m_frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateScenePresenceMovement(); m_sceneGraph.UpdateScenePresenceMovement();
// Perform the main physics update. This will do the actual work of moving objects and avatars according to their
// velocity
int tmpPhysicsMS = Util.EnvironmentTickCount(); int tmpPhysicsMS = Util.EnvironmentTickCount();
if (m_frame % m_update_physics == 0) if (m_frame % m_update_physics == 0)
{ {

View File

@ -568,16 +568,6 @@ namespace OpenSim.Region.Framework.Scenes
m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient); m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient);
} }
protected internal void DetachObject(uint objectLocalID, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null)
{
//group.DetachToGround();
m_parentScene.AttachmentsModule.ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
}
}
protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) protected internal void HandleUndo(IClientAPI remoteClient, UUID primId)
{ {
if (primId != UUID.Zero) if (primId != UUID.Zero)

View File

@ -1663,6 +1663,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
// If the agent update does move the avatar, then calculate the force ready for the velocity update,
// which occurs later in the main scene loop
if (update_movementflag || (update_rotation && DCFlagKeyPressed)) if (update_movementflag || (update_rotation && DCFlagKeyPressed))
{ {
// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
@ -4294,8 +4296,8 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
return; return;
UUID itemID = m_appearance.GetAttachedItem(p); UUID itemID = m_appearance.GetAttachedItem(p);
UUID assetID = m_appearance.GetAttachedAsset(p);
//UUID assetID = m_appearance.GetAttachedAsset(p);
// For some reason assetIDs are being written as Zero's in the DB -- need to track tat down // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
// But they're not used anyway, the item is being looked up for now, so let's proceed. // But they're not used anyway, the item is being looked up for now, so let's proceed.
//if (UUID.Zero == assetID) //if (UUID.Zero == assetID)
@ -4333,7 +4335,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString()); m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace);
} }
} }
} }

View File

@ -69,7 +69,7 @@ namespace OpenSim.Tests
[Test] [Test]
public void IncludeTests() public void IncludeTests()
{ {
const string mainIniFile = "OpenSim.ini"; const string mainIniFile = "OpenSimDefaults.ini";
m_config = new IniConfigSource(); m_config = new IniConfigSource();
// Create ini files in a directory structure // Create ini files in a directory structure

1299
bin/OpenSimDefaults.ini Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
; These are the initialization settings for running OpenSim Standalone with an SQLite database
[DatabaseService]
StorageProvider = "OpenSim.Data.SQLiteLegacy.dll"
ConnectionString = "URI=file:OpenSim.db,version=3,UseUTF16Encoding=True"
[AvatarService]
ConnectionString = "URI=file:avatars.db,version=3"
[AuthenticationService]
ConnectionString = "URI=file:auth.db,version=3"
[UserAccountService]
ConnectionString = "URI=file:userprofiles.db,version=3"
[FriendsService]
ConnectionString = "URI=file:friends.db,version=3"

View File

@ -0,0 +1,26 @@
; These are the initialization settings for running OpenSim Standalone with an SQLite database
[DatabaseService]
StorageProvider = "OpenSim.Data.SQLite.dll"
ConnectionString = "URI=file:OpenSim.db,version=3,UseUTF16Encoding=True"
[InventoryService]
;ConnectionString = "URI=file:inventory.db,version=3"
; if you have a legacy inventory store use the connection string below
ConnectionString = "URI=file:inventory.db,version=3,UseUTF16Encoding=True"
[AvatarService]
ConnectionString = "URI=file:avatars.db,version=3"
[AuthenticationService]
ConnectionString = "URI=file:auth.db,version=3"
[UserAccountService]
ConnectionString = "URI=file:userprofiles.db,version=3"
[GridUserService]
ConnectionString = "URI=file:griduser.db,version=3"
[FriendsService]
ConnectionString = "URI=file:friends.db,version=3"