aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/General/ClientManager.cs56
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/General/NullClientAPI.cs5
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs1
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs44
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs13
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs20
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs28
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs2
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs3
10 files changed, 108 insertions, 68 deletions
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs
index 0e45d03..274a2d3 100644
--- a/OpenSim/Framework/General/ClientManager.cs
+++ b/OpenSim/Framework/General/ClientManager.cs
@@ -1,15 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife.Packets;
4using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
5 6
6namespace OpenSim.Framework 7namespace OpenSim.Framework
7{ 8{
8 public delegate void ForEachClientDelegate( IClientAPI client ); 9 public delegate void ForEachClientDelegate(IClientAPI client);
9 public class ClientManager 10 public class ClientManager
10 { 11 {
11 private Dictionary<uint, IClientAPI> m_clients; 12 private Dictionary<uint, IClientAPI> m_clients;
12 13
13 public void ForEachClient(ForEachClientDelegate whatToDo) 14 public void ForEachClient(ForEachClientDelegate whatToDo)
14 { 15 {
15 foreach (IClientAPI client in m_clients.Values) 16 foreach (IClientAPI client in m_clients.Values)
@@ -17,20 +18,59 @@ namespace OpenSim.Framework
17 whatToDo(client); 18 whatToDo(client);
18 } 19 }
19 } 20 }
20 21
21 public ClientManager() 22 public ClientManager()
22 { 23 {
23 m_clients = new Dictionary<uint, IClientAPI>(); 24 m_clients = new Dictionary<uint, IClientAPI>();
24 } 25 }
25 26
26 public void Remove(uint id) 27 public void Remove(uint id)
27 { 28 {
28 m_clients.Remove(id); 29 m_clients.Remove(id);
29 } 30 }
31
32 public void Add(uint id, IClientAPI client)
33 {
34 m_clients.Add(id, client);
35 }
36
37 public void InPacket(uint circuitCode, libsecondlife.Packets.Packet packet)
38 {
39 IClientAPI client;
40
41 if (m_clients.TryGetValue(circuitCode, out client))
42 {
43 client.InPacket(packet);
44 }
45 }
46
47 public void ConnectionClosed(uint circuitCode)
48 {
49 IClientAPI client;
50
51 if (m_clients.TryGetValue(circuitCode, out client))
52 {
53 m_clients.Remove(circuitCode);
54 client.Close();
55
56 // TODO: Now remove all local childagents too
57 }
58 }
30 59
31 public void Add(uint id, IClientAPI client ) 60 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
32 { 61 {
33 m_clients.Add( id, client ); 62 ViewerEffectPacket packet = new ViewerEffectPacket();
63 packet.Effect = effectBlock;
64
65 foreach (IClientAPI client in m_clients.Values)
66 {
67 if (client.AgentId != sender.AgentId)
68 {
69 packet.AgentData.AgentID = client.AgentId;
70 packet.AgentData.SessionID = client.SessionId;
71 client.OutPacket(packet);
72 }
73 }
34 } 74 }
35 } 75 }
36} 76}
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 580a263..9c0771f 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -34,6 +34,7 @@ using OpenSim.Framework.Data;
34 34
35namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
36{ 36{
37 public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock);
37 public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 38 public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list 39 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list
39 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); 40 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
@@ -242,6 +243,7 @@ namespace OpenSim.Framework.Interfaces
242 void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); 243 void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
243 void SetDebug(int newDebug); 244 void SetDebug(int newDebug);
244 void InPacket(Packet NewPack); 245 void InPacket(Packet NewPack);
245 void ConnectionClosed(); 246 void Close();
247 event ViewerEffectEventHandler OnViewerEffect;
246 } 248 }
247} 249}
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index 2b6de9e..2fe46d6 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Framework
52 public event StatusChange OnChildAgentStatus; 52 public event StatusChange OnChildAgentStatus;
53 public event GenericCall2 OnStopMovement; 53 public event GenericCall2 OnStopMovement;
54 public event GenericCall6 OnRemoveAvatar; 54 public event GenericCall6 OnRemoveAvatar;
55 public event ViewerEffectEventHandler OnViewerEffect;
55 56
56 public event CreateNewInventoryItem OnCreateNewInventoryItem; 57 public event CreateNewInventoryItem OnCreateNewInventoryItem;
57 public event CreateInventoryFolder OnCreateNewInventoryFolder; 58 public event CreateInventoryFolder OnCreateNewInventoryFolder;
@@ -172,9 +173,11 @@ namespace OpenSim.Framework
172 { 173 {
173 } 174 }
174 175
175 public void ConnectionClosed() 176 public void Close()
176 { 177 {
177 } 178 }
179
180
178 } 181 }
179} 182}
180 183
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 9d5a9e8..a15a964 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Region.ClientStack
42{ 42{
43 partial class ClientView 43 partial class ClientView
44 { 44 {
45 public event ViewerEffectEventHandler OnViewerEffect;
45 public event ImprovedInstantMessage OnInstantMessage; 46 public event ImprovedInstantMessage OnInstantMessage;
46 public event ChatFromViewer OnChatFromViewer; 47 public event ChatFromViewer OnChatFromViewer;
47 public event RezObject OnRezObject; 48 public event RezObject OnRezObject;
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index 71fea0d..65ad431 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -37,13 +37,28 @@ namespace OpenSim.Region.ClientStack
37 protected virtual void RegisterLocalPacketHandlers() 37 protected virtual void RegisterLocalPacketHandlers()
38 { 38 {
39 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); 39 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
40 this.AddLocalPacketHandler(PacketType.ViewerEffect, this.HandleViewerEffect);
40 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); 41 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
41 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); 42 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
42 } 43 }
43 44
44 protected virtual bool Logout(IClientAPI simClient, Packet packet) 45 private bool HandleViewerEffect(IClientAPI sender, Packet Pack)
45 { 46 {
46 MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); 47 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
48
49 if( OnViewerEffect != null )
50 {
51 OnViewerEffect(sender, viewer.Effect);
52 }
53
54 return true;
55 }
56
57 protected virtual bool Logout(IClientAPI client, Packet packet)
58 {
59 // TODO: Refactor out this into an OnLogout so the ClientManager can close all clients.
60
61 MainLog.Instance.Verbose("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
47 //send reply to let the client logout 62 //send reply to let the client logout
48 LogoutReplyPacket logReply = new LogoutReplyPacket(); 63 LogoutReplyPacket logReply = new LogoutReplyPacket();
49 logReply.AgentData.AgentID = this.AgentId; 64 logReply.AgentData.AgentID = this.AgentId;
@@ -52,8 +67,9 @@ namespace OpenSim.Region.ClientStack
52 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); 67 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
53 logReply.InventoryData[0].ItemID = LLUUID.Zero; 68 logReply.InventoryData[0].ItemID = LLUUID.Zero;
54 OutPacket(logReply); 69 OutPacket(logReply);
55 // 70 //
56 this.KillClient(); 71 this.Close();
72
57 return true; 73 return true;
58 } 74 }
59 75
@@ -81,7 +97,7 @@ namespace OpenSim.Region.ClientStack
81 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) 97 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet)
82 { 98 {
83 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; 99 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
84 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); 100 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
85 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 101 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
86 { 102 {
87 #region position 103 #region position
@@ -99,7 +115,7 @@ namespace OpenSim.Region.ClientStack
99 if (OnUpdatePrimSinglePosition != null) 115 if (OnUpdatePrimSinglePosition != null)
100 { 116 {
101 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 117 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
102 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 118 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
103 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 119 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
104 } 120 }
105 } 121 }
@@ -128,7 +144,7 @@ namespace OpenSim.Region.ClientStack
128 if (OnUpdatePrimGroupRotation != null) 144 if (OnUpdatePrimGroupRotation != null)
129 { 145 {
130 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 146 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
131 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 147 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
132 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 148 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
133 } 149 }
134 } 150 }
@@ -139,7 +155,7 @@ namespace OpenSim.Region.ClientStack
139 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 155 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
140 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); 156 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
141 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 157 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
142 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 158 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
143 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); 159 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
144 } 160 }
145 } 161 }
@@ -164,10 +180,10 @@ namespace OpenSim.Region.ClientStack
164 if (OnUpdatePrimScale != null) 180 if (OnUpdatePrimScale != null)
165 { 181 {
166 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 182 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
167 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); 183 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
168 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 184 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
169 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 185 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
170 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 186 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
171 } 187 }
172 } 188 }
173 else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab 189 else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab
@@ -175,7 +191,7 @@ namespace OpenSim.Region.ClientStack
175 if (OnUpdatePrimScale != null) 191 if (OnUpdatePrimScale != null)
176 { 192 {
177 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 193 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
178 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 194 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
179 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 195 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
180 } 196 }
181 } 197 }
@@ -184,7 +200,7 @@ namespace OpenSim.Region.ClientStack
184 if (OnUpdatePrimScale != null) 200 if (OnUpdatePrimScale != null)
185 { 201 {
186 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 202 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
187 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 203 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
188 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 204 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
189 } 205 }
190 } 206 }
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 95ce3c5..009ddac 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -75,19 +75,6 @@ namespace OpenSim.Region.ClientStack
75 75
76 switch (Pack.Type) 76 switch (Pack.Type)
77 { 77 {
78 case PacketType.ViewerEffect:
79 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
80 foreach (IClientAPI client in m_clientThreads.Values)
81 {
82 if (client.AgentId != this.AgentId)
83 {
84 viewer.AgentData.AgentID = client.AgentId;
85 viewer.AgentData.SessionID = client.SessionId;
86 client.OutPacket(viewer);
87 }
88 }
89 break;
90
91 #region Scene/Avatar 78 #region Scene/Avatar
92 case PacketType.AvatarPropertiesRequest: 79 case PacketType.AvatarPropertiesRequest:
93 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 80 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 2bff88a..f8ac1d8 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.ClientStack
71 private LLUUID newAssetFolder = LLUUID.Zero; 71 private LLUUID newAssetFolder = LLUUID.Zero;
72 private int debug = 0; 72 private int debug = 0;
73 protected IScene m_scene; 73 protected IScene m_scene;
74 private Dictionary<uint, IClientAPI> m_clientThreads; 74 private ClientManager m_clientManager;
75 private AssetCache m_assetCache; 75 private AssetCache m_assetCache;
76 // private InventoryCache m_inventoryCache; 76 // private InventoryCache m_inventoryCache;
77 private int cachedtextureserial = 0; 77 private int cachedtextureserial = 0;
@@ -83,12 +83,12 @@ namespace OpenSim.Region.ClientStack
83 private int probesWithNoIngressPackets = 0; 83 private int probesWithNoIngressPackets = 0;
84 private int lastPacketsReceived = 0; 84 private int lastPacketsReceived = 0;
85 85
86 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, IClientAPI> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) 86 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
87 { 87 {
88 m_moneyBalance = 1000; 88 m_moneyBalance = 1000;
89 89
90 m_scene = scene; 90 m_scene = scene;
91 m_clientThreads = clientThreads; 91 m_clientManager = clientManager;
92 m_assetCache = assetCache; 92 m_assetCache = assetCache;
93 93
94 m_networkServer = packServer; 94 m_networkServer = packServer;
@@ -127,24 +127,17 @@ namespace OpenSim.Region.ClientStack
127 127
128 # region Client Methods 128 # region Client Methods
129 129
130 public void KillClient() 130 public void Close()
131 { 131 {
132 clientPingTimer.Stop(); 132 clientPingTimer.Stop();
133 133
134 m_scene.RemoveClient(this.AgentId); 134 m_scene.RemoveClient(this.AgentId);
135 135
136 m_clientThreads.Remove(this.CircuitCode); 136 m_clientManager.Remove(this.CircuitCode); // TODO: Move out and delete ref to clientmanager.
137 m_networkServer.RemoveClientCircuit(this.CircuitCode); 137 m_networkServer.RemoveClientCircuit(this.CircuitCode);
138 this.ClientThread.Abort(); 138 this.ClientThread.Abort();
139 } 139 }
140 140
141 public void ConnectionClosed()
142 {
143 clientPingTimer.Stop();
144 m_clientThreads.Remove(this.CircuitCode);
145 m_networkServer.RemoveClientCircuit(this.CircuitCode);
146 this.ClientThread.Abort();
147 }
148 #endregion 141 #endregion
149 142
150 # region Packet Handling 143 # region Packet Handling
@@ -259,7 +252,8 @@ namespace OpenSim.Region.ClientStack
259 probesWithNoIngressPackets++; 252 probesWithNoIngressPackets++;
260 if (probesWithNoIngressPackets > 30) 253 if (probesWithNoIngressPackets > 30)
261 { 254 {
262 this.KillClient(); 255 // Refactor out this into an OnConnectionClosed so the ClientManager can clean up
256 this.Close();
263 } 257 }
264 else 258 else
265 { 259 {
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index 481e445..bceeeb3 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -40,7 +40,6 @@ namespace OpenSim.Region.ClientStack
40 { 40 {
41 private ClientStackNetworkHandler _networkHandler; 41 private ClientStackNetworkHandler _networkHandler;
42 private IScene _localScene; 42 private IScene _localScene;
43 public Dictionary<uint, IClientAPI> ClientThreads = new Dictionary<uint, IClientAPI>();
44 private ClientManager m_clientManager = new ClientManager(); 43 private ClientManager m_clientManager = new ClientManager();
45 public ClientManager ClientManager 44 public ClientManager ClientManager
46 { 45 {
@@ -66,20 +65,14 @@ namespace OpenSim.Region.ClientStack
66 /// </summary> 65 /// </summary>
67 /// <param name="circuitCode"></param> 66 /// <param name="circuitCode"></param>
68 /// <param name="packet"></param> 67 /// <param name="packet"></param>
69 public virtual void ClientInPacket(uint circuitCode, Packet packet) 68 public virtual void InPacket(uint circuitCode, Packet packet)
70 { 69 {
71 if (this.ClientThreads.ContainsKey(circuitCode)) 70 m_clientManager.InPacket(circuitCode, packet);
72 {
73 ClientThreads[circuitCode].InPacket(packet);
74 }
75 } 71 }
76 72
77 public virtual void ConnectionClosed(uint circuitCode) 73 public virtual void ConnectionClosed(uint circuitCode)
78 { 74 {
79 if (this.ClientThreads.ContainsKey(circuitCode)) 75 m_clientManager.ConnectionClosed(circuitCode);
80 {
81 ClientThreads[circuitCode].ConnectionClosed();
82 }
83 } 76 }
84 77
85 /// <summary> 78 /// <summary>
@@ -129,9 +122,9 @@ namespace OpenSim.Region.ClientStack
129 122
130 } 123 }
131 124
132 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, IClientAPI> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) 125 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
133 { 126 {
134 return new ClientView(remoteEP, initialcirpack, clientThreads, scene, assetCache, packServer, authenSessions ); 127 return new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions );
135 } 128 }
136 129
137 /// <summary> 130 /// <summary>
@@ -146,15 +139,18 @@ namespace OpenSim.Region.ClientStack
146 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass) 139 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass)
147 { 140 {
148 IClientAPI newuser = 141 IClientAPI newuser =
149 CreateNewClient(epSender, useCircuit, ClientThreads, _localScene, assetCache, this, 142 CreateNewClient(epSender, useCircuit, m_clientManager, _localScene, assetCache, this,
150 authenticateSessionsClass); 143 authenticateSessionsClass);
151 144
152 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 145 this.m_clientManager.Add(useCircuit.CircuitCode.Code, newuser);
153 this.m_clientManager.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); 146
147 newuser.OnViewerEffect += m_clientManager.ViewerEffectHandler;
154 148
155 return true; 149 return true;
156 } 150 }
157 151
152
153
158 /// <summary> 154 /// <summary>
159 /// 155 ///
160 /// </summary> 156 /// </summary>
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 10ae6ee..efc9c87 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ClientStack
126 if (this.clientCircuits.ContainsKey(epSender)) 126 if (this.clientCircuits.ContainsKey(epSender))
127 { 127 {
128 //if so then send packet to the packetserver 128 //if so then send packet to the packetserver
129 this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet); 129 this._packetServer.InPacket(this.clientCircuits[epSender], packet);
130 } 130 }
131 else if (packet.Type == PacketType.UseCircuitCode) 131 else if (packet.Type == PacketType.UseCircuitCode)
132 { 132 {
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 72a1e19..a055339 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -43,6 +43,7 @@ namespace SimpleApp
43 public event UpdateVector OnGrabObject; 43 public event UpdateVector OnGrabObject;
44 public event ObjectSelect OnDeGrabObject; 44 public event ObjectSelect OnDeGrabObject;
45 public event MoveObject OnGrabUpdate; 45 public event MoveObject OnGrabUpdate;
46 public event ViewerEffectEventHandler OnViewerEffect;
46 47
47 48
48 public event UpdateShape OnUpdatePrimShape; 49 public event UpdateShape OnUpdatePrimShape;
@@ -228,7 +229,7 @@ namespace SimpleApp
228 { 229 {
229 } 230 }
230 231
231 public void ConnectionClosed() 232 public void Close()
232 { 233 {
233 } 234 }
234 } 235 }