Merge branch 'master' into careminster

avinationmerge
Melanie 2009-11-19 17:53:34 +00:00
commit d179f2cce9
8 changed files with 87 additions and 65 deletions

View File

@ -32,11 +32,11 @@ using OpenSim.Framework;
namespace OpenSim.Data namespace OpenSim.Data
{ {
public class PresenceData public struct PresenceData
{ {
public UUID UUID; public UUID UUID;
public UUID currentRegion; public UUID currentRegion;
public Dictionary<string, object> Data; public Dictionary<string, string> Data;
} }
/// <summary> /// <summary>
@ -48,7 +48,8 @@ namespace OpenSim.Data
PresenceData Get(UUID principalID); 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); bool Delete(UUID regionID);
} }

View File

@ -112,7 +112,7 @@ namespace OpenSim.Data.MySQL
for (int i = 0 ; i < fields.Length ; i++) for (int i = 0 ; i < fields.Length ; i++)
{ {
cmd.Parameters.AddWithValue(fields[i], keys[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()); string where = String.Join(" and ", terms.ToArray());
@ -190,11 +190,26 @@ namespace OpenSim.Data.MySQL
return DoQuery(cmd); return DoQuery(cmd);
} }
public void Store(T row) public bool Store(T row)
{ {
MySqlCommand cmd = new MySqlCommand(); MySqlCommand cmd = new MySqlCommand();
string query = ""; string query = "";
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;
} }
} }
} }

View File

@ -28,33 +28,6 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; 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.IO;
using System.Text; using System.Text;
using HttpServer; using HttpServer;
@ -77,9 +50,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private readonly BaseHttpServer m_server; private readonly BaseHttpServer m_server;
private BlockingQueue<PollServiceHttpRequest> m_request; private BlockingQueue<PollServiceHttpRequest> m_request;
private bool m_running = true; private bool m_running = true;
private int m_timeout = 250; private int m_timeout = 250;
public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout) public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout)
{ {
@ -135,4 +106,4 @@ namespace OpenSim.Framework.Servers.HttpServer
m_request.Enqueue(pPollServiceHttpRequest); m_request.Enqueue(pPollServiceHttpRequest);
} }
} }
} }

View File

@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes
// allocations, and there is no more work to be done until someone logs in // allocations, and there is no more work to be done until someone logs in
GC.Collect(); GC.Collect();
m_log.Debug("[REGION]: Enabling Logins"); m_log.DebugFormat("[REGION]: Enabling Logins for {0}", RegionInfo.RegionName);
loginsdisabled = false; loginsdisabled = false;
} }
} }
@ -1276,24 +1276,25 @@ namespace OpenSim.Region.Framework.Scenes
} }
catch (AccessViolationException e) 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) //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) 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) 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 finally
{ {
m_lastupdate = DateTime.UtcNow; m_lastupdate = DateTime.UtcNow;
} }
maintc = Environment.TickCount - maintc; maintc = Environment.TickCount - maintc;
maintc = (int)(m_timespan * 1000) - maintc; maintc = (int)(m_timespan * 1000) - maintc;

View File

@ -94,6 +94,33 @@ namespace OpenSim.Server.Handlers.Presence
byte[] Report(Dictionary<string, string> request) byte[] Report(Dictionary<string, string> request)
{ {
PresenceInfo info = new PresenceInfo();
info.Data = new Dictionary<string, string>();
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<string, string> 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(); return FailureResult();
} }

View File

@ -231,13 +231,14 @@ namespace OpenSim.Services.Connectors
} }
catch (TimeoutException e) catch (TimeoutException e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation to {0} timed out {0} {1}.", m_ServerURI, m_log.ErrorFormat(
e.Source, e.Message); "[INVENTORY CONNECTOR]: GetFolderContent operation to {0} for {1} timed out {2} {3}.",
m_ServerURI, folderID, e.Source, e.Message);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?).", m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed for {0}, {1} {2} (old server?).",
e.Source, e.Message); folderID, e.Source, e.Message);
} }
InventoryCollection nullCollection = new InventoryCollection(); InventoryCollection nullCollection = new InventoryCollection();
@ -256,8 +257,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed for {0} {1}, {2} {3}",
e.Source, e.Message); folder.Name, folder.ID, e.Source, e.Message);
} }
return false; return false;
@ -272,8 +273,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed for {0} {1}, {2} {3}",
e.Source, e.Message); folder.Name, folder.ID, e.Source, e.Message);
} }
return false; return false;
@ -307,8 +308,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed for {0} {1}, {2} {3}",
e.Source, e.Message); folder.Name, folder.ID, e.Source, e.Message);
} }
return false; return false;
@ -323,8 +324,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Purge inventory folder operation failed for {0} {1}, {2} {3}",
e.Source, e.Message); folder.Name, folder.ID, e.Source, e.Message);
} }
return false; return false;
@ -340,8 +341,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed for folder {0}, {1} {2}",
e.Source, e.Message); folderID, e.Source, e.Message);
} }
return null; return null;
@ -356,8 +357,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed for {0} {1}, {2} {3}",
e.Source, e.Message); item.Name, item.ID, e.Source, e.Message);
} }
return false; return false;
@ -372,8 +373,8 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed, {0} {1}", m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed for {0} {1}, {2} {3}",
e.Source, e.Message); item.Name, item.ID, e.Source, e.Message);
} }
return false; return false;
@ -443,7 +444,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) 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); e.Source, e.Message);
} }
@ -475,7 +476,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) 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); e.Source, e.Message);
} }
@ -576,9 +577,6 @@ namespace OpenSim.Services.Connectors
} }
callback(folders, items); callback(folders, items);
} }
} }
} }

View File

@ -35,7 +35,7 @@ namespace OpenSim.Services.Interfaces
{ {
public UUID PrincipalID; public UUID PrincipalID;
public UUID RegionID; public UUID RegionID;
public Dictionary<string, object> Data; public Dictionary<string, string> Data;
} }
public interface IPresenceService public interface IPresenceService

View File

@ -52,6 +52,15 @@ namespace OpenSim.Services.PresenceService
public bool Report(PresenceInfo presence) public bool Report(PresenceInfo presence)
{ {
PresenceData p = new PresenceData();
p.Data = new Dictionary<string, string>();
p.UUID = presence.PrincipalID;
p.currentRegion = presence.RegionID;
foreach (KeyValuePair<string, string> kvp in presence.Data)
p.Data[kvp.Key] = kvp.Value;
return false; return false;
} }
} }