aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-20 19:07:42 +0000
committerJustin Clarke Casey2008-04-20 19:07:42 +0000
commitdcaf457bb82221a90d56e4be057766c898f5c2dd (patch)
treeb706d6b9b37dc055849fbf97095bd8175c5fb041 /OpenSim
parent* Change lazy user inventory creation on first login to synchronous rather th... (diff)
downloadopensim-SC-dcaf457bb82221a90d56e4be057766c898f5c2dd.zip
opensim-SC-dcaf457bb82221a90d56e4be057766c898f5c2dd.tar.gz
opensim-SC-dcaf457bb82221a90d56e4be057766c898f5c2dd.tar.bz2
opensim-SC-dcaf457bb82221a90d56e4be057766c898f5c2dd.tar.xz
* Change user inventory create from explicit 'create user' command on the console from sync to async
* Catch more error conditions and provide more messages when things go wrong
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Grid/UserServer/Main.cs36
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs9
2 files changed, 34 insertions, 11 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 19f037f..0f0104e 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -157,7 +157,9 @@ namespace OpenSim.Grid.UserServer
157 157
158 if (null != m_userManager.GetUserProfile(tempfirstname, templastname)) 158 if (null != m_userManager.GetUserProfile(tempfirstname, templastname))
159 { 159 {
160 m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); 160 m_log.ErrorFormat(
161 "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
162
161 break; 163 break;
162 } 164 }
163 165
@@ -166,22 +168,40 @@ namespace OpenSim.Grid.UserServer
166 LLUUID userID = new LLUUID(); 168 LLUUID userID = new LLUUID();
167 try 169 try
168 { 170 {
169 userID = 171 userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
170 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 172 }
171 } catch (Exception ex) 173 catch (Exception ex)
172 { 174 {
173 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); 175 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
174 } 176 }
175 177
176 try 178 try
177 { 179 {
178 RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", 180 bool created
179 userID.UUID); 181 = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
182 "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
183
184 if (!created)
185 {
186 throw new Exception(
187 String.Format(
188 "The inventory creation request for user {0} did not succeed."
189 + " Please contact your inventory service provider for more information.",
190 userID));
191 }
192
193 }
194 catch (System.Net.WebException e)
195 {
196 m_log.ErrorFormat(
197 "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
198 m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
180 } 199 }
181 catch (Exception ex) 200 catch (Exception e)
182 { 201 {
183 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", ex.ToString()); 202 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
184 } 203 }
204
185 m_lastCreatedUser = userID; 205 m_lastCreatedUser = userID;
186 break; 206 break;
187 } 207 }
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index e71a2cc..eb548a5 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -310,14 +310,15 @@ namespace OpenSim.Grid.UserServer
310 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 310 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
311 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 311 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
312 312
313 // In theory, the user will only ever be missing a root folder in situations where a grid
314 // which didn't previously run a grid wide inventory server is being transitioned to one
315 // which does.
316 if (null == folders || folders.Count == 0) 313 if (null == folders || folders.Count == 0)
317 { 314 {
318 m_log.InfoFormat( 315 m_log.InfoFormat(
319 "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID); 316 "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
320 317
318 // Although the create user function creates a new agent inventory along with a new user profile, some
319 // tools are creating the user profile directly in the database without creating the inventory. At
320 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
321 // exist.
321 bool created = 322 bool created =
322 SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( 323 SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
323 "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID); 324 "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
@@ -340,6 +341,7 @@ namespace OpenSim.Grid.UserServer
340 LLUUID rootID = LLUUID.Zero; 341 LLUUID rootID = LLUUID.Zero;
341 ArrayList AgentInventoryArray = new ArrayList(); 342 ArrayList AgentInventoryArray = new ArrayList();
342 Hashtable TempHash; 343 Hashtable TempHash;
344
343 foreach (InventoryFolderBase InvFolder in folders) 345 foreach (InventoryFolderBase InvFolder in folders)
344 { 346 {
345// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); 347// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
@@ -356,6 +358,7 @@ namespace OpenSim.Grid.UserServer
356 TempHash["folder_id"] = InvFolder.ID.ToString(); 358 TempHash["folder_id"] = InvFolder.ID.ToString();
357 AgentInventoryArray.Add(TempHash); 359 AgentInventoryArray.Add(TempHash);
358 } 360 }
361
359 return new InventoryData(AgentInventoryArray, rootID); 362 return new InventoryData(AgentInventoryArray, rootID);
360 } 363 }
361 else 364 else