clear userAgent state on client shutdown, which fixes the issue

where you could only login once with a given id in standalone mode.
This commit is contained in:
Sean Dague
2007-07-31 14:42:50 +00:00
parent 7db7ad0722
commit 55b569069d
8 changed files with 84 additions and 12 deletions

View File

@@ -129,26 +129,31 @@ namespace OpenSim.Framework.Data.DB4o
}
/// <summary>
/// Adds a new profile to the database (Warning: Probably slow.)
/// Adds or updates a record to the user database. Do this when changes are needed
/// in the user profile that need to be persistant.
///
/// TODO: the logic here is not ACID, the local cache will be
/// updated even if the persistant data is not. This may lead
/// to unexpected results.
/// </summary>
/// <param name="row">The profile to add</param>
/// <returns>Successful?</returns>
public bool AddRow(UserProfileData row)
/// <param name="record">The profile to update</param>
/// <returns>true on success, false on fail to persist to db</returns>
public bool UpdateRecord(UserProfileData record)
{
if (userProfiles.ContainsKey(row.UUID))
if (userProfiles.ContainsKey(record.UUID))
{
userProfiles[row.UUID] = row;
userProfiles[record.UUID] = record;
}
else
{
userProfiles.Add(row.UUID, row);
userProfiles.Add(record.UUID, record);
}
try
{
IObjectContainer database;
database = Db4oFactory.OpenFile(dbfl);
database.Set(row);
database.Set(record);
database.Close();
return true;
}
@@ -157,7 +162,5 @@ namespace OpenSim.Framework.Data.DB4o
return false;
}
}
}
}

View File

@@ -139,13 +139,30 @@ namespace OpenSim.Framework.Data.DB4o
{
try
{
manager.AddRow(user);
manager.UpdateRecord(user);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
/// <summary>
/// Creates a new user profile
/// </summary>
/// <param name="user">The profile to add to the database</param>
/// <returns>True on success, false on error</returns>
public bool updateUserProfile(UserProfileData user)
{
try {
return manager.UpdateRecord(user);
} catch (Exception e) {
Console.WriteLine(e.ToString());
return false;
}
}
/// <summary>
/// Creates a new user agent