From 913887a8e5a84efaca4babe71d0b2110bccbbc90 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 21 Feb 2009 15:15:54 +0000 Subject: [PATCH] Some more refactoring of GridServer. --- OpenSim/Grid/GridServer/GridDBService.cs | 25 +++------------------ OpenSim/Grid/GridServer/GridXmlRpcModule.cs | 21 ++++++++++++++++- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/OpenSim/Grid/GridServer/GridDBService.cs b/OpenSim/Grid/GridServer/GridDBService.cs index 389cf6912a..94c8dcdaf5 100644 --- a/OpenSim/Grid/GridServer/GridDBService.cs +++ b/OpenSim/Grid/GridServer/GridDBService.cs @@ -197,14 +197,13 @@ namespace OpenSim.Grid.GridServer return regions; } - public void LoginRegion(RegionProfileData sim, RegionProfileData existingSim) + public DataResponse LoginRegion(RegionProfileData sim, RegionProfileData existingSim) { + DataResponse insertResponse = DataResponse.RESPONSE_ERROR; foreach (IGridDataPlugin plugin in _plugins) { try { - DataResponse insertResponse; - if (existingSim == null) { insertResponse = plugin.AddProfile(sim); @@ -213,25 +212,6 @@ namespace OpenSim.Grid.GridServer { insertResponse = plugin.UpdateProfile(sim); } - - switch (insertResponse) - { - case DataResponse.RESPONSE_OK: - m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName); - break; - case DataResponse.RESPONSE_ERROR: - m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName); - break; - case DataResponse.RESPONSE_INVALIDCREDENTIALS: - m_log.Warn("[LOGIN END]: " + - "Sim login failed (Invalid Credentials): " + sim.regionName); - break; - case DataResponse.RESPONSE_AUTHREQUIRED: - m_log.Warn("[LOGIN END]: " + - "Sim login failed (Authentication Required): " + - sim.regionName); - break; - } } catch (Exception e) { @@ -240,6 +220,7 @@ namespace OpenSim.Grid.GridServer m_log.Warn("[LOGIN END]: " + e.ToString()); } } + return insertResponse; } public DataResponse DeleteRegion(string uuid) diff --git a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer/GridXmlRpcModule.cs index af83985762..c2cd1d671e 100644 --- a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs +++ b/OpenSim/Grid/GridServer/GridXmlRpcModule.cs @@ -305,7 +305,26 @@ namespace OpenSim.Grid.GridServer return e.XmlRpcErrorResponse; } - m_gridDBService.LoginRegion(sim, existingSim); + DataResponse insertResponse = m_gridDBService.LoginRegion(sim, existingSim); + + switch (insertResponse) + { + case DataResponse.RESPONSE_OK: + m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName); + break; + case DataResponse.RESPONSE_ERROR: + m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName); + break; + case DataResponse.RESPONSE_INVALIDCREDENTIALS: + m_log.Warn("[LOGIN END]: " + + "Sim login failed (Invalid Credentials): " + sim.regionName); + break; + case DataResponse.RESPONSE_AUTHREQUIRED: + m_log.Warn("[LOGIN END]: " + + "Sim login failed (Authentication Required): " + + sim.regionName); + break; + } XmlRpcResponse response = CreateLoginResponse(sim);