Merge branch 'master' of git://opensimulator.org/git/opensim

connector_plugin
Dan Lake 2012-10-08 15:25:26 -07:00
commit d342adaa87
13 changed files with 153 additions and 48 deletions

View File

@ -44,7 +44,6 @@ namespace OpenSim.Framework
public Vector3 Position;
public byte[] binaryBucket;
public uint ParentEstateID;
public Guid RegionID;
public uint timestamp;
@ -58,7 +57,7 @@ namespace OpenSim.Framework
string _fromAgentName, UUID _toAgentID,
byte _dialog, bool _fromGroup, string _message,
UUID _imSessionID, bool _offline, Vector3 _position,
byte[] _binaryBucket)
byte[] _binaryBucket, bool addTimestamp)
{
fromAgentID = _fromAgentID.Guid;
fromAgentName = _fromAgentName;
@ -79,7 +78,9 @@ namespace OpenSim.Framework
ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID;
RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid;
}
timestamp = (uint)Util.UnixTimeSinceEpoch();
if (addTimestamp)
timestamp = (uint)Util.UnixTimeSinceEpoch();
}
public GridInstantMessage(IScene scene, UUID _fromAgentID,
@ -87,7 +88,7 @@ namespace OpenSim.Framework
string _message, bool _offline,
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
_toAgentID, _dialog, false, _message,
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0])
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true)
{
}
}

View File

@ -5862,7 +5862,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
msgpack.MessageBlock.ID,
msgpack.MessageBlock.Offline != 0 ? true : false,
msgpack.MessageBlock.Position,
msgpack.MessageBlock.BinaryBucket);
msgpack.MessageBlock.BinaryBucket,
true);
handlerInstantMessage(this, im);
}

View File

@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.FirstName+" "+client.LastName,
destID, (byte)211, false,
String.Empty,
transactionID, false, new Vector3(), new byte[0]),
transactionID, false, new Vector3(), new byte[0], true),
delegate(bool success) {} );
}
}

View File

@ -297,6 +297,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
});
}
}
// XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~<name>
// to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis
// of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously
// done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here.
else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{
UUID destinationFolderID = UUID.Zero;
@ -308,6 +313,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
if (destinationFolderID != UUID.Zero)
{
InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId);
if (destinationFolder == null)
{
m_log.WarnFormat(
"[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist",
client.Name, scene.Name, destinationFolderID);
return;
}
IInventoryService invService = scene.InventoryService;
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
@ -315,9 +330,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
item = invService.GetItem(item);
InventoryFolderBase folder = null;
UUID? previousParentFolderID = null;
if (item != null) // It's an item
{
previousParentFolderID = item.Folder;
item.Folder = destinationFolderID;
invService.DeleteItems(item.Owner, new List<UUID>() { item.ID });
@ -330,10 +347,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
if (folder != null) // It's a folder
{
previousParentFolderID = folder.ParentID;
folder.ParentID = destinationFolderID;
invService.MoveFolder(folder);
}
}
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
if (previousParentFolderID != null)
{
InventoryFolderBase previousParentFolder
= new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId);
previousParentFolder = invService.GetFolder(previousParentFolder);
scene.SendInventoryUpdate(client, previousParentFolder, true, true);
scene.SendInventoryUpdate(client, destinationFolder, true, true);
}
}
}
else if (
@ -354,9 +383,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
item = invService.GetItem(item);
InventoryFolderBase folder = null;
UUID? previousParentFolderID = null;
if (item != null && trashFolder != null)
{
previousParentFolderID = item.Folder;
item.Folder = trashFolder.ID;
// Diva comment: can't we just update this item???
@ -372,6 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
if (folder != null & trashFolder != null)
{
previousParentFolderID = folder.ParentID;
folder.ParentID = trashFolder.ID;
invService.MoveFolder(folder);
}
@ -391,6 +423,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
client.SendAgentAlertMessage("Unable to delete "+
"received inventory" + reason, false);
}
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
else if (previousParentFolderID != null)
{
InventoryFolderBase previousParentFolder
= new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId);
previousParentFolder = invService.GetFolder(previousParentFolder);
scene.SendInventoryUpdate(client, previousParentFolder, true, true);
scene.SendInventoryUpdate(client, trashFolder, true, true);
}
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));

View File

@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
client.FirstName+" "+client.LastName, targetid,
(byte)InstantMessageDialog.RequestTeleport, false,
message, sessionID, false, presence.AbsolutePosition,
new Byte[0]);
new Byte[0], true);
m.RegionID = client.Scene.RegionInfo.RegionID.Guid;
m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message);

View File

@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
client.FirstName+" "+client.LastName, targetid,
(byte)InstantMessageDialog.RequestTeleport, false,
message, dest, false, presence.AbsolutePosition,
new Byte[0]);
new Byte[0], true);
if (m_TransferModule != null)
{

View File

@ -1068,6 +1068,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Scene initiatingScene)
{
Thread.Sleep(10000);
IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
if (im != null)
{
@ -1080,11 +1081,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
(uint)(int)position.X,
(uint)(int)position.Y,
(uint)(int)position.Z);
GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero,
"Region", agent.UUID,
(byte)InstantMessageDialog.GodLikeRequestTeleport, false,
"", gotoLocation, false, new Vector3(127, 0, 0),
new Byte[0]);
GridInstantMessage m
= new GridInstantMessage(
initiatingScene,
UUID.Zero,
"Region",
agent.UUID,
(byte)InstantMessageDialog.GodLikeRequestTeleport,
false,
"",
gotoLocation,
false,
new Vector3(127, 0, 0),
new Byte[0],
false);
im.SendInstantMessage(m, delegate(bool success)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Client Initiating Teleport sending IM success = {0}", success);

View File

@ -1424,7 +1424,7 @@ namespace OpenSim.Region.Framework.Scenes
return newFolderID;
}
private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
public void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
{
if (folder == null)
return;

View File

@ -148,7 +148,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
OnInstantMessage(this, new GridInstantMessage(m_scene,
m_uuid, m_firstname + " " + m_lastname,
target, 0, false, message,
UUID.Zero, false, Position, new byte[0]));
UUID.Zero, false, Position, new byte[0], true));
}
public void SendAgentOffline(UUID[] agentIDs)

View File

@ -3978,7 +3978,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.RegionInfo.RegionName+" "+
m_host.AbsolutePosition.ToString(),
agentItem.ID, true, m_host.AbsolutePosition,
bucket);
bucket, true); // TODO: May actually send no timestamp
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
@ -6453,15 +6453,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
byte[] bucket = new byte[] { (byte)AssetType.Folder };
Vector3 pos = m_host.AbsolutePosition;
GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name + ", an object owned by " +
resolveName(m_host.OwnerID) + ",", destID,
m_host.OwnerID, m_host.Name, destID,
(byte)InstantMessageDialog.TaskInventoryOffered,
false, category + "\n" + m_host.Name + " is located at " +
World.RegionInfo.RegionName + " " +
m_host.AbsolutePosition.ToString(),
folderID, true, m_host.AbsolutePosition,
bucket);
false, string.Format("'{0}'"),
// We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06
// false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z),
folderID, false, pos,
bucket, false);
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.UserStatistics
/// <summary>
/// User statistics sessions keyed by agent ID
/// </summary>
private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
private Dictionary<UUID, UserSession> m_sessions = new Dictionary<UUID, UserSession>();
private List<Scene> m_scenes = new List<Scene>();
private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
@ -319,14 +319,18 @@ namespace OpenSim.Region.UserStatistics
private void OnMakeRootAgent(ScenePresence agent)
{
// m_log.DebugFormat(
// "[WEB STATS MODULE]: Looking for session {0} for {1} in {2}",
// agent.ControllingClient.SessionId, agent.Name, agent.Scene.Name);
lock (m_sessions)
{
UserSessionID uid;
UserSession uid;
if (!m_sessions.ContainsKey(agent.UUID))
{
UserSessionData usd = UserSessionUtil.newUserSessionData();
uid = new UserSessionID();
uid = new UserSession();
uid.name_f = agent.Firstname;
uid.name_l = agent.Lastname;
uid.session_data = usd;
@ -411,9 +415,9 @@ namespace OpenSim.Region.UserStatistics
return String.Empty;
}
private UserSessionID ParseViewerStats(string request, UUID agentID)
private UserSession ParseViewerStats(string request, UUID agentID)
{
UserSessionID uid = new UserSessionID();
UserSession uid = new UserSession();
UserSessionData usd;
OSD message = OSDParser.DeserializeLLSDXml(request);
OSDMap mmap;
@ -425,22 +429,25 @@ namespace OpenSim.Region.UserStatistics
if (!m_sessions.ContainsKey(agentID))
{
m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
return new UserSessionID();
return new UserSession();
}
uid = m_sessions[agentID];
// m_log.DebugFormat("[WEB STATS MODULE]: Got session {0} for {1}", uid.session_id, agentID);
}
else
{
// parse through the beginning to locate the session
if (message.Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
mmap = (OSDMap)message;
{
UUID sessionID = mmap["session_id"].AsUUID();
if (sessionID == UUID.Zero)
return new UserSessionID();
return new UserSession();
// search through each session looking for the owner
@ -459,7 +466,7 @@ namespace OpenSim.Region.UserStatistics
// can't find a session
if (agentID == UUID.Zero)
{
return new UserSessionID();
return new UserSession();
}
}
}
@ -468,12 +475,12 @@ namespace OpenSim.Region.UserStatistics
usd = uid.session_data;
if (message.Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
mmap = (OSDMap)message;
{
if (mmap["agent"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap agent_map = (OSDMap)mmap["agent"];
usd.agent_id = agentID;
usd.name_f = uid.name_f;
@ -493,17 +500,18 @@ namespace OpenSim.Region.UserStatistics
(float)agent_map["fps"].AsReal());
if (mmap["downloads"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap downloads_map = (OSDMap)mmap["downloads"];
usd.d_object_kb = (float)downloads_map["object_kbytes"].AsReal();
usd.d_texture_kb = (float)downloads_map["texture_kbytes"].AsReal();
usd.d_world_kb = (float)downloads_map["workd_kbytes"].AsReal();
// m_log.DebugFormat("[WEB STATS MODULE]: mmap[\"session_id\"] = [{0}]", mmap["session_id"].AsUUID());
usd.session_id = mmap["session_id"].AsUUID();
if (mmap["system"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap system_map = (OSDMap)mmap["system"];
usd.s_cpu = system_map["cpu"].AsString();
@ -512,13 +520,13 @@ namespace OpenSim.Region.UserStatistics
usd.s_ram = system_map["ram"].AsInteger();
if (mmap["stats"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap stats_map = (OSDMap)mmap["stats"];
{
if (stats_map["failures"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap stats_failures = (OSDMap)stats_map["failures"];
usd.f_dropped = stats_failures["dropped"].AsInteger();
usd.f_failed_resends = stats_failures["failed_resends"].AsInteger();
@ -527,18 +535,18 @@ namespace OpenSim.Region.UserStatistics
usd.f_send_packet = stats_failures["send_packet"].AsInteger();
if (stats_map["net"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap stats_net = (OSDMap)stats_map["net"];
{
if (stats_net["in"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap net_in = (OSDMap)stats_net["in"];
usd.n_in_kb = (float)net_in["kbytes"].AsReal();
usd.n_in_pk = net_in["packets"].AsInteger();
if (stats_net["out"].Type != OSDType.Map)
return new UserSessionID();
return new UserSession();
OSDMap net_out = (OSDMap)stats_net["out"];
usd.n_out_kb = (float)net_out["kbytes"].AsReal();
@ -549,11 +557,18 @@ namespace OpenSim.Region.UserStatistics
uid.session_data = usd;
m_sessions[agentID] = uid;
// m_log.DebugFormat(
// "[WEB STATS MODULE]: Parse data for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id);
return uid;
}
private void UpdateUserStats(UserSessionID uid, SqliteConnection db)
private void UpdateUserStats(UserSession uid, SqliteConnection db)
{
// m_log.DebugFormat(
// "[WEB STATS MODULE]: Updating user stats for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id);
if (uid.session_id == UUID.Zero)
return;
@ -740,7 +755,6 @@ VALUES
s.min_ping = ArrayMin_f(__ping);
s.max_ping = ArrayMax_f(__ping);
s.mode_ping = ArrayMode_f(__ping);
}
#region Statistics
@ -985,7 +999,7 @@ VALUES
}
#region structs
public struct UserSessionID
public class UserSession
{
public UUID session_id;
public UUID region_id;

View File

@ -60,7 +60,25 @@ namespace OpenSim.Server
}
string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
string[] conns = connList.Split(new char[] {',', ' '});
IConfig servicesConfig = m_Server.Config.Configs["ServiceList"];
if (servicesConfig != null)
{
List<string> servicesList = new List<string>();
if (connList != String.Empty)
servicesList.Add(connList);
foreach (string k in servicesConfig.GetKeys())
{
string v = servicesConfig.GetString(k);
if (v != String.Empty)
servicesList.Add(v);
}
connList = String.Join(",", servicesList.ToArray());
}
string[] conns = connList.Split(new char[] {',', ' ', '\n', '\r', '\t'});
// int i = 0;
foreach (string c in conns)

View File

@ -13,7 +13,23 @@
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
; *
[Startup]
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector"
[ServiceList]
AssetServiceConnector = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector"
InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector"
VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector"
GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector"
GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector"
AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector"
OpenIdServerConnector = "8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector"
AvatarServiceConnector = "8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector"
LLLoginServiceInConnector = "8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector"
PresenceServiceConnector = "8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector"
UserAccountServiceConnector = "8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector"
GridUserServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector"
FriendsServiceConnector = "8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector"
MapAddServiceConnector = "8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector"
MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector"
; * This is common for all services, it's the network setup for the entire
; * server instance, if none is specified above