diff options
author | Sean Dague | 2007-07-31 14:42:50 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-31 14:42:50 +0000 |
commit | 55b569069dfd6eb7c87d4fbd66d68083878f6c65 (patch) | |
tree | 55863a76a9c4797ee8d9fa954868e1d650e0d7be /OpenSim/Framework/Data.DB4o | |
parent | * Fixed a bug where the simulator could crash if the userserver was particula... (diff) | |
download | opensim-SC_OLD-55b569069dfd6eb7c87d4fbd66d68083878f6c65.zip opensim-SC_OLD-55b569069dfd6eb7c87d4fbd66d68083878f6c65.tar.gz opensim-SC_OLD-55b569069dfd6eb7c87d4fbd66d68083878f6c65.tar.bz2 opensim-SC_OLD-55b569069dfd6eb7c87d4fbd66d68083878f6c65.tar.xz |
clear userAgent state on client shutdown, which fixes the issue
where you could only login once with a given id in standalone mode.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oManager.cs | 23 | ||||
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 19 |
2 files changed, 31 insertions, 11 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 43f9095..0e32938 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs | |||
@@ -129,26 +129,31 @@ namespace OpenSim.Framework.Data.DB4o | |||
129 | } | 129 | } |
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Adds a new profile to the database (Warning: Probably slow.) | 132 | /// Adds or updates a record to the user database. Do this when changes are needed |
133 | /// in the user profile that need to be persistant. | ||
134 | /// | ||
135 | /// TODO: the logic here is not ACID, the local cache will be | ||
136 | /// updated even if the persistant data is not. This may lead | ||
137 | /// to unexpected results. | ||
133 | /// </summary> | 138 | /// </summary> |
134 | /// <param name="row">The profile to add</param> | 139 | /// <param name="record">The profile to update</param> |
135 | /// <returns>Successful?</returns> | 140 | /// <returns>true on success, false on fail to persist to db</returns> |
136 | public bool AddRow(UserProfileData row) | 141 | public bool UpdateRecord(UserProfileData record) |
137 | { | 142 | { |
138 | if (userProfiles.ContainsKey(row.UUID)) | 143 | if (userProfiles.ContainsKey(record.UUID)) |
139 | { | 144 | { |
140 | userProfiles[row.UUID] = row; | 145 | userProfiles[record.UUID] = record; |
141 | } | 146 | } |
142 | else | 147 | else |
143 | { | 148 | { |
144 | userProfiles.Add(row.UUID, row); | 149 | userProfiles.Add(record.UUID, record); |
145 | } | 150 | } |
146 | 151 | ||
147 | try | 152 | try |
148 | { | 153 | { |
149 | IObjectContainer database; | 154 | IObjectContainer database; |
150 | database = Db4oFactory.OpenFile(dbfl); | 155 | database = Db4oFactory.OpenFile(dbfl); |
151 | database.Set(row); | 156 | database.Set(record); |
152 | database.Close(); | 157 | database.Close(); |
153 | return true; | 158 | return true; |
154 | } | 159 | } |
@@ -157,7 +162,5 @@ namespace OpenSim.Framework.Data.DB4o | |||
157 | return false; | 162 | return false; |
158 | } | 163 | } |
159 | } | 164 | } |
160 | |||
161 | |||
162 | } | 165 | } |
163 | } | 166 | } |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 831b198..88caeb8 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs | |||
@@ -139,13 +139,30 @@ namespace OpenSim.Framework.Data.DB4o | |||
139 | { | 139 | { |
140 | try | 140 | try |
141 | { | 141 | { |
142 | manager.AddRow(user); | 142 | manager.UpdateRecord(user); |
143 | } | 143 | } |
144 | catch (Exception e) | 144 | catch (Exception e) |
145 | { | 145 | { |
146 | Console.WriteLine(e.ToString()); | 146 | Console.WriteLine(e.ToString()); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | |||
150 | /// <summary> | ||
151 | /// Creates a new user profile | ||
152 | /// </summary> | ||
153 | /// <param name="user">The profile to add to the database</param> | ||
154 | /// <returns>True on success, false on error</returns> | ||
155 | public bool updateUserProfile(UserProfileData user) | ||
156 | { | ||
157 | try { | ||
158 | return manager.UpdateRecord(user); | ||
159 | } catch (Exception e) { | ||
160 | Console.WriteLine(e.ToString()); | ||
161 | return false; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | |||
149 | 166 | ||
150 | /// <summary> | 167 | /// <summary> |
151 | /// Creates a new user agent | 168 | /// Creates a new user agent |