Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie Thielker 2010-09-14 22:14:23 +02:00
commit 540a1912ce
17 changed files with 1418 additions and 121 deletions

View File

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

View File

@ -1,46 +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 System;
using System.Collections.Generic;
using System.Reflection;
using System.Diagnostics;
using log4net;
namespace OpenSim.Framework
{
public static class ThreadTracker
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static ProcessThreadCollection GetThreads()
{
Process thisProc = Process.GetCurrentProcess();
return thisProc.Threads;
}
}
}

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using log4net;
@ -43,7 +44,7 @@ namespace OpenSim.Framework
const int WATCHDOG_TIMEOUT_MS = 5000;
[System.Diagnostics.DebuggerDisplay("{Thread.Name}")]
private class ThreadWatchdogInfo
public class ThreadWatchdogInfo
{
public Thread Thread;
public int LastTick;
@ -150,6 +151,15 @@ namespace OpenSim.Framework
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)
{
WatchdogTimeout callback = OnWatchdogTimeout;

View File

@ -5222,11 +5222,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
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;
}

View File

@ -695,9 +695,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet.Header.Reliable && !udpClient.PacketArchive.TryEnqueue(packet.Header.Sequence))
{
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
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
return;

View File

@ -187,18 +187,20 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
int start, 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);
int len = end - start + 1;
//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.ContentLength = end - start;
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, end - start);
response.Body.Write(texture.Data, start, len);
}
else
{

View File

@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
itemID = group.GetFromItemID();
}
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
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)
{
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
}
@ -238,11 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (updateInventoryStatus)
{
if (att == null)
{
ShowDetachInUserInventory(itemID, remoteClient);
}
SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
else
ShowAttachInUserInventory(att, remoteClient, itemID, AttachmentPt);
}
if (null == att)
@ -313,12 +309,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
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)
{
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
remoteClient.Name, att.Name, itemID);
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
// remoteClient.Name, att.Name, itemID);
if (!att.IsDeleted)
AttachmentPt = att.RootPart.AttachmentPoint;
@ -343,7 +347,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <param name="AttachmentPt"></param>
/// <param name="itemID"></param>
/// <param name="att"></param>
public void SetAttachmentInventoryStatus(
protected void ShowAttachInUserInventory(
IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
{
// m_log.DebugFormat(
@ -407,7 +411,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// Save avatar attachment information
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);
}
}

View File

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

View File

@ -115,17 +115,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="remoteClient"></param>
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>
/// Update the user inventory to show a detach.
/// </summary>

View File

@ -1343,16 +1343,17 @@ namespace OpenSim.Region.Framework.Scenes
// Check if any objects have reached their targets
CheckAtTargets();
// Run through all ScenePresences looking for updates
// Presence updates and queued object updates for each presence are sent to clients
if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences();
// Update SceneObjectGroups that have scheduled themselves for updates
// Objects queue their updates onto all scene presences
if (m_frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups();
// Run through all ScenePresences looking for updates
// Presence updates and queued object updates for each presence are sent to clients
if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences();
// Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
if (m_frame % m_update_coarse_locations == 0)
{
List<Vector3> coarseLocations;
@ -1370,9 +1371,12 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.UpdatePreparePhysics();
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
// Apply any pending avatar force input to the avatar's velocity
if (m_frame % m_update_entitymovement == 0)
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();
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);
}
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)
{
if (primId != UUID.Zero)

View File

@ -1800,9 +1800,9 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
// m_log.DebugFormat(
// "[SCENE]: Storing {0}, {1} in {2}",
// Name, UUID, m_scene.RegionInfo.RegionName);
// m_log.DebugFormat(
// "[SCENE]: Storing {0}, {1} in {2}",
// Name, UUID, m_scene.RegionInfo.RegionName);
SceneObjectGroup backup_group = Copy(false);
backup_group.RootPart.Velocity = RootPart.Velocity;

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))
{
// 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;
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
// But they're not used anyway, the item is being looked up for now, so let's proceed.
//if (UUID.Zero == assetID)
@ -4328,12 +4330,12 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
}
m_log.InfoFormat(
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
p, itemID, assetID, asset);
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {3}",
p, itemID, asset);
}
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]
public void IncludeTests()
{
const string mainIniFile = "OpenSim.ini";
const string mainIniFile = "OpenSimDefaults.ini";
m_config = new IniConfigSource();
// 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"