diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/ClientStack/ClientView.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 86 |
1 files changed, 49 insertions, 37 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 6d49e34..55f50a4 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -36,7 +36,7 @@ using libsecondlife.Packets; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | using OpenSim.Framework.Communications.Cache; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using Timer = System.Timers.Timer; | 39 | using Timer=System.Timers.Timer; |
40 | 40 | ||
41 | namespace OpenSim.Region.ClientStack | 41 | namespace OpenSim.Region.ClientStack |
42 | { | 42 | { |
@@ -50,8 +50,11 @@ namespace OpenSim.Region.ClientStack | |||
50 | { | 50 | { |
51 | public static TerrainManager TerrainManager; | 51 | public static TerrainManager TerrainManager; |
52 | 52 | ||
53 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 53 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = |
54 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance | 54 | new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
55 | |||
56 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); | ||
57 | //local handlers for this instance | ||
55 | 58 | ||
56 | private LLUUID m_sessionId; | 59 | private LLUUID m_sessionId; |
57 | public LLUUID SecureSessionID = LLUUID.Zero; | 60 | public LLUUID SecureSessionID = LLUUID.Zero; |
@@ -84,7 +87,9 @@ namespace OpenSim.Region.ClientStack | |||
84 | private int probesWithNoIngressPackets = 0; | 87 | private int probesWithNoIngressPackets = 0; |
85 | private int lastPacketsReceived = 0; | 88 | private int lastPacketsReceived = 0; |
86 | 89 | ||
87 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) | 90 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, |
91 | IScene scene, AssetCache assetCache, PacketServer packServer, | ||
92 | AgentCircuitManager authenSessions) | ||
88 | { | 93 | { |
89 | m_moneyBalance = 1000; | 94 | m_moneyBalance = 1000; |
90 | 95 | ||
@@ -96,11 +101,11 @@ namespace OpenSim.Region.ClientStack | |||
96 | // m_inventoryCache = inventoryCache; | 101 | // m_inventoryCache = inventoryCache; |
97 | m_authenticateSessionsHandler = authenSessions; | 102 | m_authenticateSessionsHandler = authenSessions; |
98 | 103 | ||
99 | MainLog.Instance.Verbose("CLIENT","Started up new client thread to handle incoming request"); | 104 | MainLog.Instance.Verbose("CLIENT", "Started up new client thread to handle incoming request"); |
100 | cirpack = initialcirpack; | 105 | cirpack = initialcirpack; |
101 | userEP = remoteEP; | 106 | userEP = remoteEP; |
102 | 107 | ||
103 | this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); | 108 | startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); |
104 | 109 | ||
105 | PacketQueue = new BlockingQueue<QueItem>(); | 110 | PacketQueue = new BlockingQueue<QueItem>(); |
106 | 111 | ||
@@ -109,7 +114,7 @@ namespace OpenSim.Region.ClientStack | |||
109 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | 114 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); |
110 | AckTimer.Start(); | 115 | AckTimer.Start(); |
111 | 116 | ||
112 | this.RegisterLocalPacketHandlers(); | 117 | RegisterLocalPacketHandlers(); |
113 | 118 | ||
114 | ClientThread = new Thread(new ThreadStart(AuthUser)); | 119 | ClientThread = new Thread(new ThreadStart(AuthUser)); |
115 | ClientThread.IsBackground = true; | 120 | ClientThread.IsBackground = true; |
@@ -121,7 +126,7 @@ namespace OpenSim.Region.ClientStack | |||
121 | get { return m_sessionId; } | 126 | get { return m_sessionId; } |
122 | } | 127 | } |
123 | 128 | ||
124 | public void SetDebug(int newDebug) | 129 | public void SetDebug(int newDebug) |
125 | { | 130 | { |
126 | debug = newDebug; | 131 | debug = newDebug; |
127 | } | 132 | } |
@@ -132,14 +137,15 @@ namespace OpenSim.Region.ClientStack | |||
132 | { | 137 | { |
133 | clientPingTimer.Stop(); | 138 | clientPingTimer.Stop(); |
134 | 139 | ||
135 | m_scene.RemoveClient(this.AgentId); | 140 | m_scene.RemoveClient(AgentId); |
136 | 141 | ||
137 | this.ClientThread.Abort(); | 142 | ClientThread.Abort(); |
138 | } | 143 | } |
139 | 144 | ||
140 | #endregion | 145 | #endregion |
141 | 146 | ||
142 | # region Packet Handling | 147 | # region Packet Handling |
148 | |||
143 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) | 149 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) |
144 | { | 150 | { |
145 | bool result = false; | 151 | bool result = false; |
@@ -195,23 +201,27 @@ namespace OpenSim.Region.ClientStack | |||
195 | 201 | ||
196 | protected void DebugPacket(string direction, Packet packet) | 202 | protected void DebugPacket(string direction, Packet packet) |
197 | { | 203 | { |
198 | if (debug > 0) { | 204 | if (debug > 0) |
205 | { | ||
199 | string info; | 206 | string info; |
200 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) | 207 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) |
201 | return; | 208 | return; |
202 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) | 209 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) |
203 | return; | 210 | return; |
204 | if (debug < 253 && ( | 211 | if (debug < 253 && ( |
205 | packet.Type == PacketType.CompletePingCheck || | 212 | packet.Type == PacketType.CompletePingCheck || |
206 | packet.Type == PacketType.StartPingCheck | 213 | packet.Type == PacketType.StartPingCheck |
207 | ) ) | 214 | )) |
208 | return; | 215 | return; |
209 | if (debug < 252 && packet.Type == PacketType.PacketAck) | 216 | if (debug < 252 && packet.Type == PacketType.PacketAck) |
210 | return; | 217 | return; |
211 | 218 | ||
212 | if (debug > 1) { | 219 | if (debug > 1) |
220 | { | ||
213 | info = packet.ToString(); | 221 | info = packet.ToString(); |
214 | } else { | 222 | } |
223 | else | ||
224 | { | ||
215 | info = packet.Type.ToString(); | 225 | info = packet.Type.ToString(); |
216 | } | 226 | } |
217 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); | 227 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); |
@@ -242,6 +252,7 @@ namespace OpenSim.Region.ClientStack | |||
242 | } | 252 | } |
243 | } | 253 | } |
244 | } | 254 | } |
255 | |||
245 | # endregion | 256 | # endregion |
246 | 257 | ||
247 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) | 258 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) |
@@ -251,7 +262,7 @@ namespace OpenSim.Region.ClientStack | |||
251 | probesWithNoIngressPackets++; | 262 | probesWithNoIngressPackets++; |
252 | if (probesWithNoIngressPackets > 30) | 263 | if (probesWithNoIngressPackets > 30) |
253 | { | 264 | { |
254 | if( OnConnectionClosed != null ) | 265 | if (OnConnectionClosed != null) |
255 | { | 266 | { |
256 | OnConnectionClosed(this); | 267 | OnConnectionClosed(this); |
257 | } | 268 | } |
@@ -278,14 +289,16 @@ namespace OpenSim.Region.ClientStack | |||
278 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 289 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); |
279 | clientPingTimer.Enabled = true; | 290 | clientPingTimer.Enabled = true; |
280 | 291 | ||
281 | MainLog.Instance.Verbose("CLIENT","Adding viewer agent to scene"); | 292 | MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene"); |
282 | this.m_scene.AddNewClient(this, true); | 293 | m_scene.AddNewClient(this, true); |
283 | } | 294 | } |
284 | 295 | ||
285 | protected virtual void AuthUser() | 296 | protected virtual void AuthUser() |
286 | { | 297 | { |
287 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); | 298 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); |
288 | AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | 299 | AuthenticateResponse sessionInfo = |
300 | m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, | ||
301 | cirpack.CircuitCode.Code); | ||
289 | if (!sessionInfo.Authorised) | 302 | if (!sessionInfo.Authorised) |
290 | { | 303 | { |
291 | //session/circuit not authorised | 304 | //session/circuit not authorised |
@@ -297,27 +310,26 @@ namespace OpenSim.Region.ClientStack | |||
297 | MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); | 310 | MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); |
298 | //session is authorised | 311 | //session is authorised |
299 | m_agentId = cirpack.CircuitCode.ID; | 312 | m_agentId = cirpack.CircuitCode.ID; |
300 | this.m_sessionId = cirpack.CircuitCode.SessionID; | 313 | m_sessionId = cirpack.CircuitCode.SessionID; |
301 | this.m_circuitCode = cirpack.CircuitCode.Code; | 314 | m_circuitCode = cirpack.CircuitCode.Code; |
302 | this.firstName = sessionInfo.LoginInfo.First; | 315 | firstName = sessionInfo.LoginInfo.First; |
303 | this.lastName = sessionInfo.LoginInfo.Last; | 316 | lastName = sessionInfo.LoginInfo.Last; |
304 | 317 | ||
305 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) | 318 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) |
306 | { | 319 | { |
307 | this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; | 320 | SecureSessionID = sessionInfo.LoginInfo.SecureSession; |
308 | } | 321 | } |
309 | InitNewClient(); | 322 | InitNewClient(); |
310 | 323 | ||
311 | ClientLoop(); | 324 | ClientLoop(); |
312 | } | 325 | } |
313 | } | 326 | } |
314 | # endregion | ||
315 | 327 | ||
328 | # endregion | ||
316 | 329 | ||
317 | protected void KillThread() | 330 | protected void KillThread() |
318 | { | 331 | { |
319 | this.ClientThread.Abort(); | 332 | ClientThread.Abort(); |
320 | } | 333 | } |
321 | |||
322 | } | 334 | } |
323 | } | 335 | } \ No newline at end of file |