From 0cd3bf074a9cc50d47e6e1873a9a5346453110ce Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 18 Nov 2009 06:19:39 +0000 Subject: Change PresenceData to PresenceInfo to remove a naming conflict in the OpenSim.Data namespace --- OpenSim/Data/IPresenceData.cs | 4 ++-- OpenSim/Services/Interfaces/IPresenceService.cs | 8 ++++++++ OpenSim/Services/PresenceService/PresenceService.cs | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index ca661a2..891b590 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs @@ -34,8 +34,8 @@ namespace OpenSim.Data { public class PresenceData { - public UUID PrincipalID; - public UUID RegionID; + public UUID UUID; + public UUID currentRegion; public Dictionary Data; } diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index d33b6bc..6ceeb45 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -31,7 +31,15 @@ using OpenMetaverse; namespace OpenSim.Services.Interfaces { + public class PresenceInfo + { + public UUID PrincipalID; + public UUID RegionID; + public Dictionary Data; + } + public interface IPresenceService { + bool Report(PresenceInfo presence); } } diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index ba8eec8..8931a26 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -49,5 +49,10 @@ namespace OpenSim.Services.PresenceService : base(config) { } + + public bool Report(PresenceInfo presence) + { + return false; + } } } -- cgit v1.1 From 06ecdf1967848e3f0c6b6f98aba61c7ad099f65d Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 18 Nov 2009 08:21:28 +0000 Subject: Tweak presence handling and whip up a database connector and handler for testign the new generic table handling --- OpenSim/Data/IPresenceData.cs | 4 ++-- OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 4 +++- .../Handlers/Presence/PresenceServerPostHandler.cs | 27 ++++++++++++++++++++++ OpenSim/Services/Interfaces/IPresenceService.cs | 2 +- .../Services/PresenceService/PresenceService.cs | 9 ++++++++ 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 891b590..020ba5d 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs @@ -32,11 +32,11 @@ using OpenSim.Framework; namespace OpenSim.Data { - public class PresenceData + public struct PresenceData { public UUID UUID; public UUID currentRegion; - public Dictionary Data; + public Dictionary Data; } /// diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 4eb4a24..1521dc7 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs @@ -190,11 +190,13 @@ namespace OpenSim.Data.MySQL return DoQuery(cmd); } - public void Store(T row) + public bool Store(T row) { MySqlCommand cmd = new MySqlCommand(); string query = ""; + + return false; } } } diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 9ca5120..2558fa0 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -94,6 +94,33 @@ namespace OpenSim.Server.Handlers.Presence byte[] Report(Dictionary request) { + PresenceInfo info = new PresenceInfo(); + info.Data = new Dictionary(); + + if (request["PrincipalID"] == null || request["RegionID"] == null) + return FailureResult(); + + if (!UUID.TryParse(request["PrincipalID"].ToString(), + out info.PrincipalID)) + return FailureResult(); + + if (!UUID.TryParse(request["RegionID"].ToString(), + out info.RegionID)) + return FailureResult(); + + foreach (KeyValuePair kvp in request) + { + if (kvp.Key == "METHOD" || + kvp.Key == "PrincipalID" || + kvp.Key == "RegionID") + continue; + + info.Data[kvp.Key] = kvp.Value; + } + + if (m_PresenceService.Report(info)) + return SuccessResult(); + return FailureResult(); } diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index 6ceeb45..aa1c5bf 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -35,7 +35,7 @@ namespace OpenSim.Services.Interfaces { public UUID PrincipalID; public UUID RegionID; - public Dictionary Data; + public Dictionary Data; } public interface IPresenceService diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 8931a26..2157462 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -52,6 +52,15 @@ namespace OpenSim.Services.PresenceService public bool Report(PresenceInfo presence) { + PresenceData p = new PresenceData(); + p.Data = new Dictionary(); + + p.UUID = presence.PrincipalID; + p.currentRegion = presence.RegionID; + + foreach (KeyValuePair kvp in presence.Data) + p.Data[kvp.Key] = kvp.Value; + return false; } } -- cgit v1.1 From 23438e66e7ee3cd71652cdf6fd6a801544179ec0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 18 Nov 2009 08:53:07 +0000 Subject: Implement generic delete method --- OpenSim/Data/IPresenceData.cs | 3 ++- OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 020ba5d..e5a8ebd 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs @@ -48,7 +48,8 @@ namespace OpenSim.Data PresenceData Get(UUID principalID); - bool SetDataItem(UUID principalID, string item, string value); + bool SetUserDataItem(UUID principalID, string item, string value); + bool SetRegionDataItem(UUID principalID, string item, string value); bool Delete(UUID regionID); } diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 1521dc7..4e27e26 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs @@ -112,7 +112,7 @@ namespace OpenSim.Data.MySQL for (int i = 0 ; i < fields.Length ; i++) { cmd.Parameters.AddWithValue(fields[i], keys[i]); - terms.Add(fields[i] + " = ?" + fields[i]); + terms.Add("`" + fields[i] + "` = ?" + fields[i]); } string where = String.Join(" and ", terms.ToArray()); @@ -198,5 +198,18 @@ namespace OpenSim.Data.MySQL return false; } + + public bool Delete(string field, string val) + { + MySqlCommand cmd = new MySqlCommand(); + + cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field); + cmd.Parameters.AddWithValue(field, val); + + if (ExecuteNonQuery(cmd) > 0) + return true; + + return false; + } } } -- cgit v1.1 From 47e482217e0bba9c8c08bce65dc777c3e7f9aac2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Nov 2009 16:28:00 +0000 Subject: minor: remove duplicate copyright notice in PollServiceWorkerThread --- .../Servers/HttpServer/PollServiceWorkerThread.cs | 29 +--------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index ce32443..033450a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -28,33 +28,6 @@ using System; using System.Collections; using System.Collections.Generic; -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - using System.IO; using System.Text; using HttpServer; @@ -135,4 +108,4 @@ namespace OpenSim.Framework.Servers.HttpServer m_request.Enqueue(pPollServiceHttpRequest); } } -} +} \ No newline at end of file -- cgit v1.1 From 7166f3748a95909ce75f6e4e7bf62e4e87f05c5e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Nov 2009 18:44:47 +0000 Subject: minor: correct error messages when queryfolder fails --- OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 4 +--- OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 033450a..cc8bdb6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -50,9 +50,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private BlockingQueue m_request; private bool m_running = true; - private int m_timeout = 250; - - + private int m_timeout = 250; public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout) { diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index e047f71..d1d0645 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -475,7 +475,7 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory item operation failed, {0} {1}", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory folder operation failed, {0} {1}", e.Source, e.Message); } @@ -576,9 +576,6 @@ namespace OpenSim.Services.Connectors } callback(folders, items); - } - - } } -- cgit v1.1 From e31e14162909556a5c646afec82adbae569e70ae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Nov 2009 18:57:15 +0000 Subject: minor: Correct some inventory corrector log messages and add more identifying detail --- .../Inventory/InventoryServiceConnector.cs | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index d1d0645..f86b453 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -231,13 +231,14 @@ namespace OpenSim.Services.Connectors } catch (TimeoutException e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation to {0} timed out {0} {1}.", m_ServerURI, - e.Source, e.Message); + m_log.ErrorFormat( + "[INVENTORY CONNECTOR]: GetFolderContent operation to {0} for {1} timed out {2} {3}.", + m_ServerURI, folderID, e.Source, e.Message); } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?).", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed for {0}, {1} {2} (old server?).", + folderID, e.Source, e.Message); } InventoryCollection nullCollection = new InventoryCollection(); @@ -256,8 +257,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed for {0} {1}, {2} {3}", + folder.Name, folder.ID, e.Source, e.Message); } return false; @@ -272,8 +273,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed for {0} {1}, {2} {3}", + folder.Name, folder.ID, e.Source, e.Message); } return false; @@ -307,8 +308,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed for {0} {1}, {2} {3}", + folder.Name, folder.ID, e.Source, e.Message); } return false; @@ -323,8 +324,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Purge inventory folder operation failed for {0} {1}, {2} {3}", + folder.Name, folder.ID, e.Source, e.Message); } return false; @@ -340,8 +341,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed for folder {0}, {1} {2}", + folderID, e.Source, e.Message); } return null; @@ -356,8 +357,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed for {0} {1}, {2} {3}", + item.Name, item.ID, e.Source, e.Message); } return false; @@ -372,8 +373,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed, {0} {1}", - e.Source, e.Message); + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed for {0} {1}, {2} {3}", + item.Name, item.ID, e.Source, e.Message); } return false; @@ -443,7 +444,7 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory item operation failed, {0} {1}", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory items operation failed, {0} {1}", e.Source, e.Message); } -- cgit v1.1 From 622003ab09873537858de0d9090c0d637f82fc5f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Nov 2009 20:27:37 +0000 Subject: minor: tweak log message to say which region is being enabled for logins --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index aeca7df..2e15b86 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes // allocations, and there is no more work to be done until someone logs in GC.Collect(); - m_log.Debug("[REGION]: Enabling Logins"); + m_log.DebugFormat("[REGION]: Enabling Logins for {0}", RegionInfo.RegionName); loginsdisabled = false; } } @@ -1276,24 +1276,25 @@ namespace OpenSim.Region.Framework.Scenes } catch (AccessViolationException e) { - m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); } //catch (NullReferenceException e) //{ - // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); //} catch (InvalidOperationException e) { - m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); } catch (Exception e) { - m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); } finally { m_lastupdate = DateTime.UtcNow; } + maintc = Environment.TickCount - maintc; maintc = (int)(m_timespan * 1000) - maintc; -- cgit v1.1