From cb828c98242bf11294a9b085d8f186e37f1239e0 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Tue, 26 Feb 2008 08:31:00 +0000
Subject: * More Message server stuff. Still not ready.
---
OpenSim/Grid/MessagingServer/Main.cs | 2 +-
OpenSim/Grid/MessagingServer/MessageService.cs | 103 ++++++++++++++++++-------
2 files changed, 78 insertions(+), 27 deletions(-)
(limited to 'OpenSim/Grid/MessagingServer')
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 5a383ef..bbf25f6 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Grid.MessagingServer
if (msgsvc.registerWithUserServer())
{
httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
-
+ httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
//httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
//httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
//httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index 42277e2..d0b939b 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -101,22 +101,28 @@ namespace OpenSim.Grid.MessagingServer
/// The Agent we're processing the friendlist subscriptions
public void ProcessFriendListSubscriptions(UserPresenceData userpresence)
{
+ lock (m_presences)
+ {
+ if (!m_presences.Contains(userpresence.agentData.AgentID))
+ m_presences.Add(userpresence.agentData.AgentID, userpresence);
+ }
+
List uFriendList = userpresence.friendData;
for (int i = 0; i < uFriendList.Count; i++)
{
- m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
- m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
+ //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
+ // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
if (m_presences.Contains(uFriendList[i].Friend))
{
- UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i]];
+ UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend];
// Add backreference
SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i);
}
}
- m_presences.Add(userpresence.agentData.AgentID, userpresence);
+
}
///
@@ -220,23 +226,47 @@ namespace OpenSim.Grid.MessagingServer
///
private void ProcessLogOff(LLUUID AgentID)
{
- if (m_presences.Contains(AgentID))
+ UserPresenceData AgentData = null;
+ List AgentsNeedingNotification = new List();
+ UserPresenceData friendd = null;
+ lock (m_presences)
+ {
+ if (m_presences.Contains(AgentID))
+ {
+ AgentData = (UserPresenceData)m_presences[AgentID];
+ }
+ }
+
+ if (AgentData != null)
{
- UserPresenceData AgentData = (UserPresenceData)m_presences[AgentID];
+ AgentsNeedingNotification = AgentData.subscriptionData;
+ //lock (m_presence_BackReferences)
+ //{
+ //if (m_presence_BackReferences.Contains(AgentID))
+ //{
+ //AgentsNeedingNotification = (List)m_presence_BackReferences[AgentID];
+ //}
+ //}
- if (m_presence_BackReferences.Contains(AgentID))
+
+ for (int i = 0; i < AgentsNeedingNotification.Count; i++)
{
- List AgentsNeedingNotification = (List)m_presence_BackReferences[AgentID];
- for (int i = 0; i < AgentsNeedingNotification.Count; i++)
+ // TODO: Do Region Notifications
+ lock(m_presences)
{
- // TODO: Do Region Notifications
if (m_presences.Contains(AgentsNeedingNotification[i]))
{
- UserPresenceData friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]];
-
- // This might need to be enumerated and checked before we try to remove it.
+ friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]];
+ }
+ }
+
+ // This might need to be enumerated and checked before we try to remove it.
+ if (friendd != null)
+ {
+ lock (friendd)
+ {
friendd.subscriptionData.Remove(AgentID);
-
+
List fl = friendd.friendData;
for (int j = 0; j < fl.Count; j++)
{
@@ -247,15 +277,19 @@ namespace OpenSim.Grid.MessagingServer
}
friendd.friendData = fl;
-
- SendRegionPresenceUpdate(AgentData, friendd);
+ m_presences[AgentsNeedingNotification[i]] = friendd;
}
- removeBackReference(AgentID, AgentsNeedingNotification[i]);
+ SendRegionPresenceUpdate(AgentData, friendd);
+
+ //removeBackReference(AgentID, AgentsNeedingNotification[i]);
}
+
}
+
}
+
}
@@ -335,12 +369,24 @@ namespace OpenSim.Grid.MessagingServer
{
m_log.Info("[LOGON]: User logged on, building indexes for user");
Hashtable requestData = (Hashtable)request.Params[0];
+
+ //requestData["sendkey"] = serv.sendkey;
+ //requestData["agentid"] = agentID.ToString();
+ //requestData["sessionid"] = sessionID.ToString();
+ //requestData["regionid"] = RegionID.ToString();
+ //requestData["regionhandle"] = regionhandle.ToString();
+ //requestData["positionx"] = positionX.ToString();
+ //requestData["positiony"] = positionY.ToString();
+ //requestData["positionz"] = positionZ.ToString();
+ //requestData["firstname"] = firstname;
+ //requestData["lastname"] = lastname;
+
AgentCircuitData agentData = new AgentCircuitData();
- agentData.SessionID = new LLUUID((string)requestData["session_id"]);
+ agentData.SessionID = new LLUUID((string)requestData["sessionid"]);
agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
agentData.firstname = (string)requestData["firstname"];
agentData.lastname = (string)requestData["lastname"];
- agentData.AgentID = new LLUUID((string)requestData["agent_id"]);
+ agentData.AgentID = new LLUUID((string)requestData["agentid"]);
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
agentData.CapsPath = (string)requestData["caps_path"];
@@ -351,9 +397,9 @@ namespace OpenSim.Grid.MessagingServer
else
{
agentData.startpos =
- new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),
- Convert.ToUInt32(requestData["startpos_y"]),
- Convert.ToUInt32(requestData["startpos_z"]));
+ new LLVector3(Convert.ToUInt32(requestData["positionx"]),
+ Convert.ToUInt32(requestData["positiony"]),
+ Convert.ToUInt32(requestData["positionz"]));
agentData.child = false;
}
@@ -383,10 +429,10 @@ namespace OpenSim.Grid.MessagingServer
Hashtable requestData = (Hashtable)request.Params[0];
- LLUUID AgentID = new LLUUID((string)requestData["agent_id"]);
+ LLUUID AgentID = new LLUUID((string)requestData["agentid"]);
- //ProcessLogOff(AgentID);
+ ProcessLogOff(AgentID);
return new XmlRpcResponse();
@@ -458,8 +504,13 @@ namespace OpenSim.Grid.MessagingServer
regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]);
regionProfile.regionName = (string)responseData["region_name"];
-
- m_regionInfoCache.Add(regionHandle, regionProfile);
+ lock (m_regionInfoCache)
+ {
+ if (!m_regionInfoCache.Contains(regionHandle))
+ {
+ m_regionInfoCache.Add(regionHandle, regionProfile);
+ }
+ }
}
catch (WebException)
{
--
cgit v1.1