diff options
author | Sean Dague | 2008-05-02 19:21:33 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-02 19:21:33 +0000 |
commit | 1edb7992f16795ef97323eba994d5451c4df240a (patch) | |
tree | a7ed82e2bd582925e5efdbaf2ba850182b1fe11b /OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs | |
parent | in theory this gives me a back end that will do persistance (diff) | |
download | opensim-SC-1edb7992f16795ef97323eba994d5451c4df240a.zip opensim-SC-1edb7992f16795ef97323eba994d5451c4df240a.tar.gz opensim-SC-1edb7992f16795ef97323eba994d5451c4df240a.tar.bz2 opensim-SC-1edb7992f16795ef97323eba994d5451c4df240a.tar.xz |
fixed the dos line endings
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs | 298 |
1 files changed, 149 insertions, 149 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs index 48afa84..6a033c8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs | |||
@@ -1,150 +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 | ||
28 | using System.Net; | 28 | using System.Net; |
29 | using System.Net.Sockets; | 29 | using System.Net.Sockets; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Region.ClientStack.LindenUDP; | 34 | using OpenSim.Region.ClientStack.LindenUDP; |
35 | 35 | ||
36 | namespace OpenSim.Region.ClientStack.LindenUDP | 36 | namespace OpenSim.Region.ClientStack.LindenUDP |
37 | { | 37 | { |
38 | public class LLPacketServer | 38 | public class LLPacketServer |
39 | { | 39 | { |
40 | //private static readonly log4net.ILog m_log | 40 | //private static readonly log4net.ILog m_log |
41 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 41 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
43 | private LLClientStackNetworkHandler m_networkHandler; | 43 | private LLClientStackNetworkHandler m_networkHandler; |
44 | private IScene m_scene; | 44 | private IScene m_scene; |
45 | 45 | ||
46 | //private readonly ClientManager m_clientManager = new ClientManager(); | 46 | //private readonly ClientManager m_clientManager = new ClientManager(); |
47 | //public ClientManager ClientManager | 47 | //public ClientManager ClientManager |
48 | //{ | 48 | //{ |
49 | // get { return m_clientManager; } | 49 | // get { return m_clientManager; } |
50 | //} | 50 | //} |
51 | 51 | ||
52 | public LLPacketServer(LLClientStackNetworkHandler networkHandler) | 52 | public LLPacketServer(LLClientStackNetworkHandler networkHandler) |
53 | { | 53 | { |
54 | m_networkHandler = networkHandler; | 54 | m_networkHandler = networkHandler; |
55 | m_networkHandler.RegisterPacketServer(this); | 55 | m_networkHandler.RegisterPacketServer(this); |
56 | } | 56 | } |
57 | 57 | ||
58 | public IScene LocalScene | 58 | public IScene LocalScene |
59 | { | 59 | { |
60 | set { m_scene = value; } | 60 | set { m_scene = value; } |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// | 64 | /// |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <param name="circuitCode"></param> | 66 | /// <param name="circuitCode"></param> |
67 | /// <param name="packet"></param> | 67 | /// <param name="packet"></param> |
68 | public virtual void InPacket(uint circuitCode, Packet packet) | 68 | public virtual void InPacket(uint circuitCode, Packet packet) |
69 | { | 69 | { |
70 | m_scene.ClientManager.InPacket(circuitCode, packet); | 70 | m_scene.ClientManager.InPacket(circuitCode, packet); |
71 | } | 71 | } |
72 | 72 | ||
73 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, | 73 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, |
74 | ClientManager clientManager, IScene scene, AssetCache assetCache, | 74 | ClientManager clientManager, IScene scene, AssetCache assetCache, |
75 | LLPacketServer packServer, AgentCircuitManager authenSessions, | 75 | LLPacketServer packServer, AgentCircuitManager authenSessions, |
76 | LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) | 76 | LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) |
77 | { | 77 | { |
78 | return | 78 | return |
79 | new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); | 79 | new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); |
80 | } | 80 | } |
81 | 81 | ||
82 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, | 82 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, |
83 | AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP) | 83 | AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP) |
84 | { | 84 | { |
85 | IClientAPI newuser; | 85 | IClientAPI newuser; |
86 | 86 | ||
87 | if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) | 87 | if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) |
88 | { | 88 | { |
89 | return false; | 89 | return false; |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, | 93 | newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, |
94 | authenticateSessionsClass, useCircuit.CircuitCode.ID, | 94 | authenticateSessionsClass, useCircuit.CircuitCode.ID, |
95 | useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP); | 95 | useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP); |
96 | 96 | ||
97 | m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser); | 97 | m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser); |
98 | 98 | ||
99 | newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler; | 99 | newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler; |
100 | newuser.OnLogout += LogoutHandler; | 100 | newuser.OnLogout += LogoutHandler; |
101 | newuser.OnConnectionClosed += CloseClient; | 101 | newuser.OnConnectionClosed += CloseClient; |
102 | 102 | ||
103 | return true; | 103 | return true; |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | public void LogoutHandler(IClientAPI client) | 107 | public void LogoutHandler(IClientAPI client) |
108 | { | 108 | { |
109 | client.SendLogoutPacket(); | 109 | client.SendLogoutPacket(); |
110 | 110 | ||
111 | CloseClient(client); | 111 | CloseClient(client); |
112 | } | 112 | } |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// | 115 | /// |
116 | /// </summary> | 116 | /// </summary> |
117 | /// <param name="buffer"></param> | 117 | /// <param name="buffer"></param> |
118 | /// <param name="size"></param> | 118 | /// <param name="size"></param> |
119 | /// <param name="flags"></param> | 119 | /// <param name="flags"></param> |
120 | /// <param name="circuitcode"></param> | 120 | /// <param name="circuitcode"></param> |
121 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) | 121 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
122 | { | 122 | { |
123 | m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); | 123 | m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); |
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// | 127 | /// |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <param name="circuitcode"></param> | 129 | /// <param name="circuitcode"></param> |
130 | public virtual void CloseCircuit(uint circuitcode) | 130 | public virtual void CloseCircuit(uint circuitcode) |
131 | { | 131 | { |
132 | m_networkHandler.RemoveClientCircuit(circuitcode); | 132 | m_networkHandler.RemoveClientCircuit(circuitcode); |
133 | 133 | ||
134 | //m_scene.ClientManager.CloseAllAgents(circuitcode); | 134 | //m_scene.ClientManager.CloseAllAgents(circuitcode); |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Completely close down the given client. | 138 | /// Completely close down the given client. |
139 | /// </summary> | 139 | /// </summary> |
140 | /// <param name="client"></param> | 140 | /// <param name="client"></param> |
141 | public virtual void CloseClient(IClientAPI client) | 141 | public virtual void CloseClient(IClientAPI client) |
142 | { | 142 | { |
143 | //m_log.Info("PacketServer:CloseClient()"); | 143 | //m_log.Info("PacketServer:CloseClient()"); |
144 | 144 | ||
145 | CloseCircuit(client.CircuitCode); | 145 | CloseCircuit(client.CircuitCode); |
146 | m_scene.ClientManager.Remove(client.CircuitCode); | 146 | m_scene.ClientManager.Remove(client.CircuitCode); |
147 | client.Close(false); | 147 | client.Close(false); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } \ No newline at end of file | 150 | } \ No newline at end of file |