aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/PacketServer.cs
diff options
context:
space:
mode:
authorlbsa712007-09-18 13:29:16 +0000
committerlbsa712007-09-18 13:29:16 +0000
commit70d9cec3b5064d874f8b9622804c964beeac5f0d (patch)
tree29d4ae5a6082ea509f5c92a50582bd9b365c7a0f /OpenSim/Region/ClientStack/PacketServer.cs
parent* Handlerized ViewerEffect (diff)
downloadopensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.zip
opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.gz
opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.bz2
opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.xz
* Yet some more connectivity restructuring
* We now have CloseAllAgents( circuit ) and CloseAllCircuits( agentId ) for great justice ( but alas, still only closing on one single scene - be brave! ) * Login and ConnectionClosed now eventified and moveified awayified * Killed off unused NullClientAPI * Now the client is almost only responsible for its own closing. ( I will get that scene out of there ) * Lookin' good!
Diffstat (limited to 'OpenSim/Region/ClientStack/PacketServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs41
1 files changed, 28 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index bceeeb3..28f25bd 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -33,14 +33,15 @@ using OpenSim.Framework;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Communications.Caches; 35using OpenSim.Framework.Communications.Caches;
36using libsecondlife;
36 37
37namespace OpenSim.Region.ClientStack 38namespace OpenSim.Region.ClientStack
38{ 39{
39 public class PacketServer 40 public class PacketServer
40 { 41 {
41 private ClientStackNetworkHandler _networkHandler; 42 private ClientStackNetworkHandler m_networkHandler;
42 private IScene _localScene; 43 private IScene _localScene;
43 private ClientManager m_clientManager = new ClientManager(); 44 private readonly ClientManager m_clientManager = new ClientManager();
44 public ClientManager ClientManager 45 public ClientManager ClientManager
45 { 46 {
46 get { return m_clientManager; } 47 get { return m_clientManager; }
@@ -48,8 +49,8 @@ namespace OpenSim.Region.ClientStack
48 49
49 public PacketServer(ClientStackNetworkHandler networkHandler) 50 public PacketServer(ClientStackNetworkHandler networkHandler)
50 { 51 {
51 _networkHandler = networkHandler; 52 m_networkHandler = networkHandler;
52 _networkHandler.RegisterPacketServer(this); 53 m_networkHandler.RegisterPacketServer(this);
53 } 54 }
54 55
55 public IScene LocalScene 56 public IScene LocalScene
@@ -70,11 +71,6 @@ namespace OpenSim.Region.ClientStack
70 m_clientManager.InPacket(circuitCode, packet); 71 m_clientManager.InPacket(circuitCode, packet);
71 } 72 }
72 73
73 public virtual void ConnectionClosed(uint circuitCode)
74 {
75 m_clientManager.ConnectionClosed(circuitCode);
76 }
77
78 /// <summary> 74 /// <summary>
79 /// 75 ///
80 /// </summary> 76 /// </summary>
@@ -145,10 +141,24 @@ namespace OpenSim.Region.ClientStack
145 this.m_clientManager.Add(useCircuit.CircuitCode.Code, newuser); 141 this.m_clientManager.Add(useCircuit.CircuitCode.Code, newuser);
146 142
147 newuser.OnViewerEffect += m_clientManager.ViewerEffectHandler; 143 newuser.OnViewerEffect += m_clientManager.ViewerEffectHandler;
144 newuser.OnLogout += LogoutHandler;
145 newuser.OnConnectionClosed += CloseClient;
148 146
149 return true; 147 return true;
150 } 148 }
151 149
150 public void LogoutHandler(IClientAPI client)
151 {
152 LogoutReplyPacket logReply = new LogoutReplyPacket();
153 logReply.AgentData.AgentID = client.AgentId;
154 logReply.AgentData.SessionID = client.SessionId;
155 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
156 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
157 logReply.InventoryData[0].ItemID = LLUUID.Zero;
158 client.OutPacket(logReply);
159
160 CloseClient( client );
161 }
152 162
153 163
154 /// <summary> 164 /// <summary>
@@ -160,17 +170,22 @@ namespace OpenSim.Region.ClientStack
160 /// <param name="circuitcode"></param> 170 /// <param name="circuitcode"></param>
161 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 171 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
162 { 172 {
163 this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode); 173 this.m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
164 } 174 }
165 175
166 /// <summary> 176 /// <summary>
167 /// 177 ///
168 /// </summary> 178 /// </summary>
169 /// <param name="circuitcode"></param> 179 /// <param name="circuitcode"></param>
170 public virtual void RemoveClientCircuit(uint circuitcode) 180 public virtual void CloseCircuit(uint circuitcode)
181 {
182 m_networkHandler.RemoveClientCircuit( circuitcode );
183 m_clientManager.CloseAllAgents( circuitcode );
184 }
185
186 public virtual void CloseClient( IClientAPI client )
171 { 187 {
172 this._networkHandler.RemoveClientCircuit(circuitcode); 188 CloseCircuit( client.CircuitCode );
173 this.m_clientManager.Remove(circuitcode);
174 } 189 }
175 } 190 }
176} 191}