diff options
author | Adam Frisby | 2008-11-08 16:09:15 +0000 |
---|---|---|
committer | Adam Frisby | 2008-11-08 16:09:15 +0000 |
commit | 6d5248441d914231af36e4a378a270513b54b1f0 (patch) | |
tree | 5abc0e87a6f0353a60e89050ce3e26f4c6bbf4bc /OpenSim/Region/ClientStack | |
parent | Fix llParseString* to create LSLStrings. This makes llListFindList work (diff) | |
download | opensim-SC_OLD-6d5248441d914231af36e4a378a270513b54b1f0.zip opensim-SC_OLD-6d5248441d914231af36e4a378a270513b54b1f0.tar.gz opensim-SC_OLD-6d5248441d914231af36e4a378a270513b54b1f0.tar.bz2 opensim-SC_OLD-6d5248441d914231af36e4a378a270513b54b1f0.tar.xz |
* Implementing first of the 0.6 IClientAPI Changes
* Introducing IClientCore - this will be the key replacement for IClientAPI in the long run, it has a very minimal set of methods designed to allow you to access specialist API's.
* See https://lists.berlios.de/pipermail/opensim-dev/2008-September/003049.html for the early discussion on this.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d0f057e..ff11dff 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -37,6 +37,7 @@ using OpenMetaverse; | |||
37 | using OpenMetaverse.Packets; | 37 | using OpenMetaverse.Packets; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Client; | ||
40 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Statistics; | 42 | using OpenSim.Framework.Statistics; |
42 | using OpenSim.Region.Interfaces; | 43 | using OpenSim.Region.Interfaces; |
@@ -51,34 +52,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
51 | /// Handles new client connections | 52 | /// Handles new client connections |
52 | /// Constructor takes a single Packet and authenticates everything | 53 | /// Constructor takes a single Packet and authenticates everything |
53 | /// </summary> | 54 | /// </summary> |
54 | public class LLClientView : IClientAPI | 55 | public class LLClientView : IClientAPI, IClientCore |
55 | { | 56 | { |
56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 58 | ||
58 | // ~ClientView() | ||
59 | // { | ||
60 | // m_log.Info("[CLIENT]: LLClientView destructor called"); | ||
61 | // } | ||
62 | |||
63 | /* static variables */ | 59 | /* static variables */ |
64 | public static SynchronizeClientHandler SynchronizeClient; | 60 | public static SynchronizeClientHandler SynchronizeClient; |
65 | /* private variables */ | 61 | /* private variables */ |
66 | private readonly UUID m_sessionId; | 62 | private readonly UUID m_sessionId; |
67 | private readonly UUID m_secureSessionId = UUID.Zero; | 63 | private readonly UUID m_secureSessionId = UUID.Zero; |
68 | //private AgentAssetUpload UploadAssets; | ||
69 | 64 | ||
70 | private int m_debugPacketLevel; | 65 | private int m_debugPacketLevel; |
71 | 66 | ||
72 | private readonly AssetCache m_assetCache; | 67 | private readonly AssetCache m_assetCache; |
73 | // private InventoryCache m_inventoryCache; | ||
74 | private int m_cachedTextureSerial; | 68 | private int m_cachedTextureSerial; |
75 | private Timer m_clientPingTimer; | 69 | private Timer m_clientPingTimer; |
76 | 70 | ||
77 | private bool m_clientBlocked; | 71 | private bool m_clientBlocked; |
78 | 72 | ||
79 | private int m_probesWithNoIngressPackets; | 73 | private int m_probesWithNoIngressPackets; |
80 | //private int m_lastPacketsReceived = 0; | ||
81 | //private byte[] ZeroOutBuffer = new byte[4096]; | ||
82 | 74 | ||
83 | private readonly UUID m_agentId; | 75 | private readonly UUID m_agentId; |
84 | private readonly uint m_circuitCode; | 76 | private readonly uint m_circuitCode; |
@@ -553,7 +545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
553 | m_PacketHandler.Clear(); | 545 | m_PacketHandler.Clear(); |
554 | 546 | ||
555 | m_clientPingTimer = new Timer(5000); | 547 | m_clientPingTimer = new Timer(5000); |
556 | m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 548 | m_clientPingTimer.Elapsed += CheckClientConnectivity; |
557 | m_clientPingTimer.Enabled = true; | 549 | m_clientPingTimer.Enabled = true; |
558 | } | 550 | } |
559 | 551 | ||
@@ -608,7 +600,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
608 | protected virtual bool ProcessPacketMethod(Packet packet) | 600 | protected virtual bool ProcessPacketMethod(Packet packet) |
609 | { | 601 | { |
610 | bool result = false; | 602 | bool result = false; |
611 | bool found = false; | 603 | bool found; |
612 | PacketMethod method; | 604 | PacketMethod method; |
613 | if (m_packetHandlers.TryGetValue(packet.Type, out method)) | 605 | if (m_packetHandlers.TryGetValue(packet.Type, out method)) |
614 | { | 606 | { |
@@ -7676,5 +7668,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7676 | KillPacket kp = new KillPacket(); | 7668 | KillPacket kp = new KillPacket(); |
7677 | OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); | 7669 | OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); |
7678 | } | 7670 | } |
7671 | |||
7672 | #region IClientCore | ||
7673 | |||
7674 | private readonly Dictionary<Type, object> m_clientInterfaces = new Dictionary<Type, object>(); | ||
7675 | |||
7676 | /// <summary> | ||
7677 | /// Register an interface on this client, should only be called in the constructor. | ||
7678 | /// </summary> | ||
7679 | /// <typeparam name="T"></typeparam> | ||
7680 | /// <param name="iface"></param> | ||
7681 | protected void RegisterInterface<T>(T iface) | ||
7682 | { | ||
7683 | lock(m_clientInterfaces) | ||
7684 | { | ||
7685 | m_clientInterfaces.Add(typeof(T), iface); | ||
7686 | } | ||
7687 | } | ||
7688 | |||
7689 | public bool TryGet<T>(out T iface) | ||
7690 | { | ||
7691 | if (m_clientInterfaces.ContainsKey(typeof(T))) | ||
7692 | { | ||
7693 | iface = (T)m_clientInterfaces[typeof(T)]; | ||
7694 | return true; | ||
7695 | } | ||
7696 | iface = default(T); | ||
7697 | return false; | ||
7698 | } | ||
7699 | |||
7700 | public T Get<T>() | ||
7701 | { | ||
7702 | return (T)m_clientInterfaces[typeof(T)]; | ||
7703 | } | ||
7704 | |||
7705 | #endregion | ||
7679 | } | 7706 | } |
7680 | } | 7707 | } |