Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-02-07 23:07:36 +00:00
commit 076f2ac8db
11 changed files with 208 additions and 21 deletions

View File

@ -220,6 +220,8 @@ namespace OpenSim.Framework
args["packed_appearance"] = appmap;
}
// Old, bad way. Keeping it fow now for backwards compatibility
// OBSOLETE -- soon to be deleted
if (ServiceURLs != null && ServiceURLs.Count > 0)
{
OSDArray urls = new OSDArray(ServiceURLs.Count * 2);
@ -232,6 +234,19 @@ namespace OpenSim.Framework
args["service_urls"] = urls;
}
// again, this time the right way
if (ServiceURLs != null && ServiceURLs.Count > 0)
{
OSDMap urls = new OSDMap();
foreach (KeyValuePair<string, object> kvp in ServiceURLs)
{
//System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value);
urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString());
}
args["serviceurls"] = urls;
}
return args;
}
@ -327,7 +342,20 @@ namespace OpenSim.Framework
}
ServiceURLs = new Dictionary<string, object>();
if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
// Try parse the new way, OSDMap
if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map)
{
OSDMap urls = (OSDMap)(args["serviceurls"]);
foreach (KeyValuePair<String, OSD> kvp in urls)
{
ServiceURLs[kvp.Key] = kvp.Value.AsString();
//System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]);
}
}
// else try the old way, OSDArray
// OBSOLETE -- soon to be deleted
else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
{
OSDArray urls = (OSDArray)(args["service_urls"]);
for (int i = 0; i < urls.Count / 2; i++)

View File

@ -88,8 +88,8 @@ namespace OpenSim.Framework.Capabilities
/// handler to be removed</param>
public void Remove(string capsName)
{
// This line must be here, or caps will break!
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
m_capsHandlers.Remove(capsName);
}

View File

@ -143,6 +143,11 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
public List<string> GetStreamHandlerKeys()
{
return new List<string>(m_streamHandlers.Keys);
}
private static string GetHandlerKey(string httpMethod, string path)
{
return httpMethod + ":" + path;
@ -179,6 +184,11 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
public List<string> GetXmlRpcHandlerKeys()
{
return new List<string>(m_rpcHandlers.Keys);
}
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
{
//m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
@ -196,6 +206,12 @@ namespace OpenSim.Framework.Servers.HttpServer
return false;
}
public List<string> GetHTTPHandlerKeys()
{
return new List<string>(m_HTTPHandlers.Keys);
}
public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
{
bool pollHandlerResult = false;
@ -214,6 +230,12 @@ namespace OpenSim.Framework.Servers.HttpServer
return false;
}
public List<string> GetPollServiceHandlerKeys()
{
return new List<string>(m_pollHandlers.Keys);
}
// Note that the agent string is provided simply to differentiate
// the handlers - it is NOT required to be an actual agent header
// value.
@ -232,6 +254,11 @@ namespace OpenSim.Framework.Servers.HttpServer
return false;
}
public List<string> GetAgentHandlerKeys()
{
return new List<string>(m_agentHandlers.Keys);
}
public bool AddLLSDHandler(string path, LLSDMethod handler)
{
lock (m_llsdHandlers)
@ -245,6 +272,11 @@ namespace OpenSim.Framework.Servers.HttpServer
return false;
}
public List<string> GetLLSDHandlerKeys()
{
return new List<string>(m_llsdHandlers.Keys);
}
public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler)
{
m_defaultLlsdHandler = handler;

View File

@ -294,6 +294,18 @@ namespace OpenSim
"show connections",
"Show connection data", HandleShow);
m_console.Commands.AddCommand("region", false, "show circuits",
"show circuits",
"Show agent circuit data", HandleShow);
m_console.Commands.AddCommand("region", false, "show http-handlers",
"show http-handlers",
"Show all registered http handlers", HandleShow);
m_console.Commands.AddCommand("region", false, "show pending-objects",
"show pending-objects",
"Show # of objects on the pending queues of all scene viewers", HandleShow);
m_console.Commands.AddCommand("region", false, "show modules",
"show modules",
"Show module data", HandleShow);
@ -943,6 +955,66 @@ namespace OpenSim
MainConsole.Instance.Output(connections.ToString());
break;
case "circuits":
System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n");
m_sceneManager.ForEachScene(
delegate(Scene scene)
{
//this.HttpServer.
acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName);
foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values)
acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root"));
}
);
MainConsole.Instance.Output(acd.ToString());
break;
case "http-handlers":
System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n");
handlers.AppendFormat("* XMLRPC:\n");
foreach (String s in HttpServer.GetXmlRpcHandlerKeys())
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* HTTP:\n");
List<String> poll = HttpServer.GetPollServiceHandlerKeys();
foreach (String s in HttpServer.GetHTTPHandlerKeys())
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
handlers.AppendFormat("* Agent:\n");
foreach (String s in HttpServer.GetAgentHandlerKeys())
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* LLSD:\n");
foreach (String s in HttpServer.GetLLSDHandlerKeys())
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count);
foreach (String s in HttpServer.GetStreamHandlerKeys())
handlers.AppendFormat("\t{0}\n", s);
MainConsole.Instance.Output(handlers.ToString());
break;
case "pending-objects":
System.Text.StringBuilder pending = new System.Text.StringBuilder("Pending objects:\n");
m_sceneManager.ForEachScene(
delegate(Scene scene)
{
scene.ForEachScenePresence(
delegate(ScenePresence sp)
{
pending.AppendFormat("{0}: {1} {2} pending\n",
scene.RegionInfo.RegionName, sp.Name, sp.SceneViewer.GetPendingObjectsCount());
}
);
}
);
MainConsole.Instance.Output(pending.ToString());
break;
case "modules":
MainConsole.Instance.Output("The currently loaded shared modules are:");
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)

View File

@ -141,31 +141,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void ProcessQueues()
{
// Process all the pending adds
OutgoingPacket pendingAdd;
while (m_pendingAdds.TryDequeue(out pendingAdd))
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
if (m_pendingAdds != null)
{
while (m_pendingAdds.TryDequeue(out pendingAdd))
{
if (pendingAdd != null && m_packets != null)
{
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
}
}
}
// Process all the pending removes, including updating statistics and round-trip times
PendingAck pendingRemove;
OutgoingPacket ackedPacket;
while (m_pendingRemoves.TryDequeue(out pendingRemove))
if (m_pendingRemoves != null)
{
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
while (m_pendingRemoves.TryDequeue(out pendingRemove))
{
m_packets.Remove(pendingRemove.SequenceNumber);
// Update stats
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
if (!pendingRemove.FromResend)
if (m_pendingRemoves != null && m_packets != null)
{
// Calculate the round-trip time for this packet and its ACK
int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
if (rtt > 0)
ackedPacket.Client.UpdateRoundTrip(rtt);
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
{
m_packets.Remove(pendingRemove.SequenceNumber);
// Update stats
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
if (!pendingRemove.FromResend)
{
// Calculate the round-trip time for this packet and its ACK
int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
if (rtt > 0)
ackedPacket.Client.UpdateRoundTrip(rtt);
}
}
}
}
}
}
}
}
}

View File

@ -26,12 +26,14 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Caps=OpenSim.Framework.Capabilities.Caps;
@ -61,6 +63,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
{
m_scene = scene;
m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps",
"show capabilities",
"Shows all registered capabilities", CapabilitiesCommand);
}
public void RegionLoaded(Scene scene)
@ -72,7 +77,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this);
}
public void PostInitialise() {}
public void PostInitialise()
{
}
public void Close() {}
@ -227,5 +234,23 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
}
}
private void CapabilitiesCommand(string module, string[] cmdparams)
{
System.Text.StringBuilder caps = new System.Text.StringBuilder();
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers)
{
caps.AppendFormat("** User {0}:\n", kvp.Key);
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); )
{
Uri uri = new Uri(kvp2.Value.ToString());
caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery);
}
}
MainConsole.Instance.Output(caps.ToString());
}
}
}

View File

@ -47,7 +47,6 @@
<RegionModule id="RemoteAuthorizationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization.RemoteAuthorizationServicesConnector" />
<RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" />
<RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" />
<RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
<RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
<RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
<RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />

View File

@ -247,13 +247,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public void NeighboursCommand(string module, string[] cmdparams)
{
System.Text.StringBuilder caps = new System.Text.StringBuilder();
foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
{
m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName);
caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
List<GridRegion> regions = kvp.Value.GetNeighbours();
foreach (GridRegion r in regions)
m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
}
MainConsole.Instance.Output(caps.ToString());
}
}

View File

@ -36,5 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces
void Close();
void QueuePartForUpdate(SceneObjectPart part);
void SendPrimUpdates();
int GetPendingObjectsCount();
}
}

View File

@ -205,6 +205,14 @@ namespace OpenSim.Region.Framework.Scenes
Reset();
}
public int GetPendingObjectsCount()
{
if (m_pendingObjects != null)
return m_pendingObjects.Count;
return 0;
}
public class ScenePartUpdate
{
public UUID FullID;

View File

@ -71,6 +71,9 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
public void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
m_Generator = scene.RequestModuleInterface<IMapImageGenerator>();
if (m_Generator == null)
{