remove test presence from NullPresenceData since this appears to stop existing sessions with home locations from being picked up
only tested for a single user so this may still fail for multiple users this may well be all academic anyway since standalone need to persistently store home location in presence data in some wayslimupdates
parent
e07548d703
commit
a1643c78be
|
@ -122,7 +122,7 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?UserID", userID);
|
||||
;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
@ -131,7 +131,6 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
|
||||
List<UUID> deleteSessions = new List<UUID>();
|
||||
int online = 0;
|
||||
|
||||
|
@ -143,6 +142,7 @@ namespace OpenSim.Data.MySQL
|
|||
deleteSessions.Add(new UUID(reader["SessionID"].ToString()));
|
||||
}
|
||||
|
||||
// Leave one session behind so that we can pick up details such as home location
|
||||
if (online == 0 && deleteSessions.Count > 0)
|
||||
deleteSessions.RemoveAt(0);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data;
|
||||
|
@ -36,6 +38,8 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
public class NullPresenceData : IPresenceData
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static NullPresenceData Instance;
|
||||
|
||||
Dictionary<UUID, PresenceData> m_presenceData = new Dictionary<UUID, PresenceData>();
|
||||
|
@ -48,12 +52,14 @@ namespace OpenSim.Data.Null
|
|||
|
||||
//Console.WriteLine("[XXX] NullRegionData constructor");
|
||||
// Let's stick in a test presence
|
||||
/*
|
||||
PresenceData p = new PresenceData();
|
||||
p.SessionID = UUID.Zero;
|
||||
p.UserID = UUID.Zero.ToString();
|
||||
p.Data = new Dictionary<string, string>();
|
||||
p.Data["Online"] = true.ToString();
|
||||
m_presenceData.Add(UUID.Zero, p);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,6 +68,9 @@ namespace OpenSim.Data.Null
|
|||
if (Instance != this)
|
||||
return Instance.Store(data);
|
||||
|
||||
// m_log.DebugFormat("[NULL PRESENCE DATA]: Storing presence {0}", data.UserID);
|
||||
// Console.WriteLine("HOME for " + data.UserID + " is " + (data.Data.ContainsKey("HomeRegionID") ? data.Data["HomeRegionID"] : "Not found"));
|
||||
|
||||
m_presenceData[data.SessionID] = data;
|
||||
return true;
|
||||
}
|
||||
|
@ -100,6 +109,7 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
if (Instance != this)
|
||||
return Instance.ReportAgent(sessionID, regionID, position, lookAt);
|
||||
|
||||
if (m_presenceData.ContainsKey(sessionID))
|
||||
{
|
||||
m_presenceData[sessionID].RegionID = regionID;
|
||||
|
@ -121,6 +131,10 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
if (p.UserID == userID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL PRESENCE DATA]: Setting home location {0} {1} {2} for {3}",
|
||||
// regionID, position, lookAt, p.UserID);
|
||||
|
||||
p.Data["HomeRegionID"] = regionID.ToString();
|
||||
p.Data["HomePosition"] = position.ToString();
|
||||
p.Data["HomeLookAt"] = lookAt.ToString();
|
||||
|
@ -136,12 +150,21 @@ namespace OpenSim.Data.Null
|
|||
if (Instance != this)
|
||||
return Instance.Get(field, data);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL PRESENCE DATA]: Getting presence data for field {0} with parameter {1}", field, data);
|
||||
|
||||
List<PresenceData> presences = new List<PresenceData>();
|
||||
if (field == "UserID")
|
||||
{
|
||||
foreach (PresenceData p in m_presenceData.Values)
|
||||
{
|
||||
if (p.UserID == data)
|
||||
{
|
||||
presences.Add(p);
|
||||
// Console.WriteLine("HOME for " + p.UserID + " is " + (p.Data.ContainsKey("HomeRegionID") ? p.Data["HomeRegionID"] : "Not found"));
|
||||
}
|
||||
}
|
||||
|
||||
return presences.ToArray();
|
||||
}
|
||||
else if (field == "SessionID")
|
||||
|
@ -187,29 +210,39 @@ namespace OpenSim.Data.Null
|
|||
return;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[NULL PRESENCE DATA]: Prune called for {0}", userID);
|
||||
|
||||
List<UUID> deleteSessions = new List<UUID>();
|
||||
int online = 0;
|
||||
|
||||
foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData)
|
||||
{
|
||||
m_log.DebugFormat("Online: {0}", kvp.Value.Data["Online"]);
|
||||
|
||||
bool on = false;
|
||||
if (bool.TryParse(kvp.Value.Data["Online"], out on) && on)
|
||||
online++;
|
||||
else
|
||||
deleteSessions.Add(kvp.Key);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[NULL PRESENCE DATA]: online [{0}], deleteSession.Count [{1}]", online, deleteSessions.Count);
|
||||
|
||||
// Leave one session behind so that we can pick up details such as home location
|
||||
if (online == 0 && deleteSessions.Count > 0)
|
||||
deleteSessions.RemoveAt(0);
|
||||
|
||||
foreach (UUID s in deleteSessions)
|
||||
m_presenceData.Remove(s);
|
||||
|
||||
}
|
||||
|
||||
public bool Delete(string field, string data)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL PRESENCE DATA]: Deleting presence data for field {0} with parameter {1}", field, data);
|
||||
|
||||
if (Instance != this)
|
||||
return Delete(field, data);
|
||||
return Instance.Delete(field, data);
|
||||
|
||||
List<UUID> presences = new List<UUID>();
|
||||
if (field == "UserID")
|
||||
|
|
|
@ -279,7 +279,31 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
GridRegion region = null;
|
||||
|
||||
if (pinfo.HomeRegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.HomeRegionID)) == null)
|
||||
bool tryDefaults = false;
|
||||
|
||||
if (pinfo.HomeRegionID.Equals(UUID.Zero))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
|
||||
account.FirstName, account.LastName);
|
||||
|
||||
tryDefaults = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.HomeRegionID);
|
||||
|
||||
if (null == region)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLOGIN SERVICE]: User {0} {1} has a recorded home region of {2} but this cannot be found by the grid service",
|
||||
account.FirstName, account.LastName, pinfo.HomeRegionID);
|
||||
|
||||
tryDefaults = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (tryDefaults)
|
||||
{
|
||||
List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID);
|
||||
if (defaults != null && defaults.Count > 0)
|
||||
|
@ -288,7 +312,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
where = "safe";
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a home set and this grid does not have default locations.",
|
||||
m_log.WarnFormat(
|
||||
"[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations.",
|
||||
account.FirstName, account.LastName);
|
||||
}
|
||||
|
||||
|
@ -318,8 +343,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
position = pinfo.Position;
|
||||
lookAt = pinfo.LookAt;
|
||||
}
|
||||
return region;
|
||||
|
||||
return region;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue