aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSean Dague2007-07-31 14:42:50 +0000
committerSean Dague2007-07-31 14:42:50 +0000
commit55b569069dfd6eb7c87d4fbd66d68083878f6c65 (patch)
tree55863a76a9c4797ee8d9fa954868e1d650e0d7be
parent* Fixed a bug where the simulator could crash if the userserver was particula... (diff)
downloadopensim-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.
-rw-r--r--OpenSim/Framework/Communications/IUserServices.cs1
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oManager.cs23
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oUserData.cs19
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs7
-rw-r--r--OpenSim/Framework/Data/UserData.cs6
-rw-r--r--OpenSim/Framework/UserManager/UserManagerBase.cs31
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
8 files changed, 84 insertions, 12 deletions
diff --git a/OpenSim/Framework/Communications/IUserServices.cs b/OpenSim/Framework/Communications/IUserServices.cs
index cd97b52..40a3182 100644
--- a/OpenSim/Framework/Communications/IUserServices.cs
+++ b/OpenSim/Framework/Communications/IUserServices.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Framework.Communications
35 UserProfileData GetUserProfile(string firstName, string lastName); 35 UserProfileData GetUserProfile(string firstName, string lastName);
36 UserProfileData GetUserProfile(string name); 36 UserProfileData GetUserProfile(string name);
37 UserProfileData GetUserProfile(LLUUID avatarID); 37 UserProfileData GetUserProfile(LLUUID avatarID);
38 void clearUserAgent(LLUUID avatarID);
38 39
39 UserProfileData SetupMasterUser(string firstName, string lastName); 40 UserProfileData SetupMasterUser(string firstName, string lastName);
40 UserProfileData SetupMasterUser(string firstName, string lastName, string password); 41 UserProfileData SetupMasterUser(string firstName, string lastName, string password);
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
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 66ea465..e301eb8 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -224,6 +224,13 @@ namespace OpenSim.Framework.Data.MySQL
224 { 224 {
225 // Do nothing. 225 // Do nothing.
226 } 226 }
227
228
229 public bool updateUserProfile(UserProfileData user)
230 {
231 return true;
232 // TODO: implement
233 }
227 234
228 /// <summary> 235 /// <summary>
229 /// Performs a money transfer request between two accounts 236 /// Performs a money transfer request between two accounts
diff --git a/OpenSim/Framework/Data/UserData.cs b/OpenSim/Framework/Data/UserData.cs
index d849e12..cf8ec7b 100644
--- a/OpenSim/Framework/Data/UserData.cs
+++ b/OpenSim/Framework/Data/UserData.cs
@@ -85,6 +85,12 @@ namespace OpenSim.Framework.Data
85 void addNewUserProfile(UserProfileData user); 85 void addNewUserProfile(UserProfileData user);
86 86
87 /// <summary> 87 /// <summary>
88 /// Updates an existing user profile
89 /// </summary>
90 /// <param name="user">UserProfile to update</param>
91 bool updateUserProfile(UserProfileData user);
92
93 /// <summary>
88 /// Adds a new agent to the database 94 /// Adds a new agent to the database
89 /// </summary> 95 /// </summary>
90 /// <param name="agent">The agent to add</param> 96 /// <param name="agent">The agent to add</param>
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs
index bc923b6..61b5df4 100644
--- a/OpenSim/Framework/UserManager/UserManagerBase.cs
+++ b/OpenSim/Framework/UserManager/UserManagerBase.cs
@@ -155,6 +155,28 @@ namespace OpenSim.Framework.UserManagement
155 155
156 return null; 156 return null;
157 } 157 }
158
159 /// <summary>
160 /// Set's user profile from object
161 /// </summary>
162 /// <param name="fname">First name</param>
163 /// <param name="lname">Last name</param>
164 /// <returns>A user profile</returns>
165 public bool setUserProfile(UserProfileData data)
166 {
167 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
168 {
169 try {
170 plugin.Value.updateUserProfile(data);
171 return true;
172 } catch (Exception e) {
173 MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
174 }
175 }
176
177 return false;
178 }
179
158 #endregion 180 #endregion
159 181
160 #region Get UserAgent 182 #region Get UserAgent
@@ -202,6 +224,15 @@ namespace OpenSim.Framework.UserManagement
202 return null; 224 return null;
203 } 225 }
204 226
227 // TODO: document
228 public void clearUserAgent(LLUUID agentID)
229 {
230 UserProfileData profile = getUserProfile(agentID);
231 profile.currentAgent = null;
232 setUserProfile(profile);
233 }
234
235
205 /// <summary> 236 /// <summary>
206 /// Loads a user agent by name (not called directly) 237 /// Loads a user agent by name (not called directly)
207 /// </summary> 238 /// </summary>
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index cd9c4fe..0459e80 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -86,6 +86,11 @@ namespace OpenSim.Region.Communications.OGS1
86 return null; 86 return null;
87 } 87 }
88 88
89 public void clearUserAgent(LLUUID avatarID)
90 {
91 // TODO: implement
92 }
93
89 public UserProfileData SetupMasterUser(string firstName, string lastName) 94 public UserProfileData SetupMasterUser(string firstName, string lastName)
90 { 95 {
91 return SetupMasterUser(firstName, lastName, ""); 96 return SetupMasterUser(firstName, lastName, "");
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 70aead3..dbc6f92 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -674,7 +674,9 @@ namespace OpenSim.Region.Environment.Scenes
674 } 674 }
675 } 675 }
676 // TODO: Add the removal from physics ? 676 // TODO: Add the removal from physics ?
677 677
678 // Remove client agent from profile, so new logins will work
679 commsManager.UserServer.clearUserAgent(agentID);
678 680
679 return; 681 return;
680 } 682 }