aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-02 16:41:08 +0000
committerAdam Frisby2008-05-02 16:41:08 +0000
commit29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71 (patch)
tree848ce119d9b87bc186c20b08cc604de50a872b31 /OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
parent* Refactored ClientView into LLClientView. Removed all direct references to U... (diff)
downloadopensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.zip
opensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.tar.gz
opensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.tar.bz2
opensim-SC-29b8c84ceaaeca80bfa9c0bfc8c31e421e39ef71.tar.xz
* Commit 2/3 - Please dont attempt to update to this revision until all 3 are in.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs (renamed from OpenSim/Region/ClientStack/PacketServer.cs)299
1 files changed, 150 insertions, 149 deletions
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
index f9e3dc8..48afa84 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
@@ -1,149 +1,150 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Net; 28using System.Net;
29using System.Net.Sockets; 29using System.Net.Sockets;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
34 34using OpenSim.Region.ClientStack.LindenUDP;
35namespace OpenSim.Region.ClientStack 35
36{ 36namespace OpenSim.Region.ClientStack.LindenUDP
37 public class PacketServer 37{
38 { 38 public class LLPacketServer
39 //private static readonly log4net.ILog m_log 39 {
40 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 40 //private static readonly log4net.ILog m_log
41 41 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42 private ClientStackNetworkHandler m_networkHandler; 42
43 private IScene m_scene; 43 private LLClientStackNetworkHandler m_networkHandler;
44 44 private IScene m_scene;
45 //private readonly ClientManager m_clientManager = new ClientManager(); 45
46 //public ClientManager ClientManager 46 //private readonly ClientManager m_clientManager = new ClientManager();
47 //{ 47 //public ClientManager ClientManager
48 // get { return m_clientManager; } 48 //{
49 //} 49 // get { return m_clientManager; }
50 50 //}
51 public PacketServer(ClientStackNetworkHandler networkHandler) 51
52 { 52 public LLPacketServer(LLClientStackNetworkHandler networkHandler)
53 m_networkHandler = networkHandler; 53 {
54 m_networkHandler.RegisterPacketServer(this); 54 m_networkHandler = networkHandler;
55 } 55 m_networkHandler.RegisterPacketServer(this);
56 56 }
57 public IScene LocalScene 57
58 { 58 public IScene LocalScene
59 set { m_scene = value; } 59 {
60 } 60 set { m_scene = value; }
61 61 }
62 /// <summary> 62
63 /// 63 /// <summary>
64 /// </summary> 64 ///
65 /// <param name="circuitCode"></param> 65 /// </summary>
66 /// <param name="packet"></param> 66 /// <param name="circuitCode"></param>
67 public virtual void InPacket(uint circuitCode, Packet packet) 67 /// <param name="packet"></param>
68 { 68 public virtual void InPacket(uint circuitCode, Packet packet)
69 m_scene.ClientManager.InPacket(circuitCode, packet); 69 {
70 } 70 m_scene.ClientManager.InPacket(circuitCode, packet);
71 71 }
72 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, 72
73 ClientManager clientManager, IScene scene, AssetCache assetCache, 73 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
74 PacketServer packServer, AgentCircuitManager authenSessions, 74 ClientManager clientManager, IScene scene, AssetCache assetCache,
75 LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) 75 LLPacketServer packServer, AgentCircuitManager authenSessions,
76 { 76 LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
77 return 77 {
78 new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); 78 return
79 } 79 new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
80 80 }
81 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, 81
82 AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP) 82 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
83 { 83 AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP)
84 IClientAPI newuser; 84 {
85 85 IClientAPI newuser;
86 if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) 86
87 { 87 if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser))
88 return false; 88 {
89 } 89 return false;
90 else 90 }
91 { 91 else
92 newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, 92 {
93 authenticateSessionsClass, useCircuit.CircuitCode.ID, 93 newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this,
94 useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP); 94 authenticateSessionsClass, useCircuit.CircuitCode.ID,
95 95 useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP);
96 m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser); 96
97 97 m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser);
98 newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler; 98
99 newuser.OnLogout += LogoutHandler; 99 newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
100 newuser.OnConnectionClosed += CloseClient; 100 newuser.OnLogout += LogoutHandler;
101 101 newuser.OnConnectionClosed += CloseClient;
102 return true; 102
103 } 103 return true;
104 } 104 }
105 105 }
106 public void LogoutHandler(IClientAPI client) 106
107 { 107 public void LogoutHandler(IClientAPI client)
108 client.SendLogoutPacket(); 108 {
109 109 client.SendLogoutPacket();
110 CloseClient(client); 110
111 } 111 CloseClient(client);
112 112 }
113 /// <summary> 113
114 /// 114 /// <summary>
115 /// </summary> 115 ///
116 /// <param name="buffer"></param> 116 /// </summary>
117 /// <param name="size"></param> 117 /// <param name="buffer"></param>
118 /// <param name="flags"></param> 118 /// <param name="size"></param>
119 /// <param name="circuitcode"></param> 119 /// <param name="flags"></param>
120 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 120 /// <param name="circuitcode"></param>
121 { 121 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
122 m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); 122 {
123 } 123 m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
124 124 }
125 /// <summary> 125
126 /// 126 /// <summary>
127 /// </summary> 127 ///
128 /// <param name="circuitcode"></param> 128 /// </summary>
129 public virtual void CloseCircuit(uint circuitcode) 129 /// <param name="circuitcode"></param>
130 { 130 public virtual void CloseCircuit(uint circuitcode)
131 m_networkHandler.RemoveClientCircuit(circuitcode); 131 {
132 132 m_networkHandler.RemoveClientCircuit(circuitcode);
133 //m_scene.ClientManager.CloseAllAgents(circuitcode); 133
134 } 134 //m_scene.ClientManager.CloseAllAgents(circuitcode);
135 135 }
136 /// <summary> 136
137 /// Completely close down the given client. 137 /// <summary>
138 /// </summary> 138 /// Completely close down the given client.
139 /// <param name="client"></param> 139 /// </summary>
140 public virtual void CloseClient(IClientAPI client) 140 /// <param name="client"></param>
141 { 141 public virtual void CloseClient(IClientAPI client)
142 //m_log.Info("PacketServer:CloseClient()"); 142 {
143 143 //m_log.Info("PacketServer:CloseClient()");
144 CloseCircuit(client.CircuitCode); 144
145 m_scene.ClientManager.Remove(client.CircuitCode); 145 CloseCircuit(client.CircuitCode);
146 client.Close(false); 146 m_scene.ClientManager.Remove(client.CircuitCode);
147 } 147 client.Close(false);
148 } 148 }
149} 149 }
150} \ No newline at end of file