diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index e56d361..ff527fb 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -40,8 +40,8 @@ using OpenSim.Framework.Inventory; | |||
40 | using OpenSim.Framework.Types; | 40 | using OpenSim.Framework.Types; |
41 | using OpenSim.Framework.Utilities; | 41 | using OpenSim.Framework.Utilities; |
42 | using OpenSim.Framework.Communications.Caches; | 42 | using OpenSim.Framework.Communications.Caches; |
43 | 43 | ||
44 | using Timer=System.Timers.Timer; | 44 | using Timer = System.Timers.Timer; |
45 | 45 | ||
46 | namespace OpenSim.Region.ClientStack | 46 | namespace OpenSim.Region.ClientStack |
47 | { | 47 | { |
@@ -74,7 +74,7 @@ namespace OpenSim.Region.ClientStack | |||
74 | protected IScene m_scene; | 74 | protected IScene m_scene; |
75 | private Dictionary<uint, ClientView> m_clientThreads; | 75 | private Dictionary<uint, ClientView> m_clientThreads; |
76 | private AssetCache m_assetCache; | 76 | private AssetCache m_assetCache; |
77 | // private InventoryCache m_inventoryCache; | 77 | // private InventoryCache m_inventoryCache; |
78 | private int cachedtextureserial = 0; | 78 | private int cachedtextureserial = 0; |
79 | protected AgentCircuitManager m_authenticateSessionsHandler; | 79 | protected AgentCircuitManager m_authenticateSessionsHandler; |
80 | private Encoding enc = Encoding.ASCII; | 80 | private Encoding enc = Encoding.ASCII; |
@@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack | |||
84 | private int probesWithNoIngressPackets = 0; | 84 | private int probesWithNoIngressPackets = 0; |
85 | private int lastPacketsReceived = 0; | 85 | private int lastPacketsReceived = 0; |
86 | 86 | ||
87 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions ) | 87 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) |
88 | { | 88 | { |
89 | m_moneyBalance = 1000; | 89 | m_moneyBalance = 1000; |
90 | 90 | ||
@@ -93,10 +93,10 @@ namespace OpenSim.Region.ClientStack | |||
93 | m_assetCache = assetCache; | 93 | m_assetCache = assetCache; |
94 | 94 | ||
95 | m_networkServer = packServer; | 95 | m_networkServer = packServer; |
96 | // m_inventoryCache = inventoryCache; | 96 | // m_inventoryCache = inventoryCache; |
97 | m_authenticateSessionsHandler = authenSessions; | 97 | m_authenticateSessionsHandler = authenSessions; |
98 | 98 | ||
99 | MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); | 99 | MainLog.Instance.Verbose("OpenSimClient.cs - Started up new client thread to handle incoming request"); |
100 | cirpack = initialcirpack; | 100 | cirpack = initialcirpack; |
101 | userEP = remoteEP; | 101 | userEP = remoteEP; |
102 | 102 | ||
@@ -121,7 +121,7 @@ namespace OpenSim.Region.ClientStack | |||
121 | public void KillClient() | 121 | public void KillClient() |
122 | { | 122 | { |
123 | clientPingTimer.Stop(); | 123 | clientPingTimer.Stop(); |
124 | 124 | ||
125 | m_scene.RemoveClient(this.AgentId); | 125 | m_scene.RemoveClient(this.AgentId); |
126 | 126 | ||
127 | m_clientThreads.Remove(this.CircuitCode); | 127 | m_clientThreads.Remove(this.CircuitCode); |
@@ -186,14 +186,15 @@ namespace OpenSim.Region.ClientStack | |||
186 | 186 | ||
187 | protected virtual void ClientLoop() | 187 | protected virtual void ClientLoop() |
188 | { | 188 | { |
189 | MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); | 189 | MainLog.Instance.Verbose("OpenSimClient.cs:ClientLoop() - Entered loop"); |
190 | while (true) | 190 | while (true) |
191 | { | 191 | { |
192 | QueItem nextPacket = PacketQueue.Dequeue(); | 192 | QueItem nextPacket = PacketQueue.Dequeue(); |
193 | if (nextPacket.Incoming) | 193 | if (nextPacket.Incoming) |
194 | { | 194 | { |
195 | //is a incoming packet | 195 | //is a incoming packet |
196 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) { | 196 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) |
197 | { | ||
197 | packetsReceived++; | 198 | packetsReceived++; |
198 | } | 199 | } |
199 | ProcessInPacket(nextPacket.Packet); | 200 | ProcessInPacket(nextPacket.Packet); |
@@ -209,15 +210,21 @@ namespace OpenSim.Region.ClientStack | |||
209 | 210 | ||
210 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) | 211 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) |
211 | { | 212 | { |
212 | if (packetsReceived == lastPacketsReceived) { | 213 | if (packetsReceived == lastPacketsReceived) |
214 | { | ||
213 | probesWithNoIngressPackets++; | 215 | probesWithNoIngressPackets++; |
214 | if (probesWithNoIngressPackets > 30) { | 216 | if (probesWithNoIngressPackets > 30) |
217 | { | ||
215 | this.KillClient(); | 218 | this.KillClient(); |
216 | } else { | 219 | } |
220 | else | ||
221 | { | ||
217 | // this will normally trigger at least one packet (ping response) | 222 | // this will normally trigger at least one packet (ping response) |
218 | SendStartPingCheck(0); | 223 | SendStartPingCheck(0); |
219 | } | 224 | } |
220 | } else { | 225 | } |
226 | else | ||
227 | { | ||
221 | // Something received in the meantime - we can reset the counters | 228 | // Something received in the meantime - we can reset the counters |
222 | probesWithNoIngressPackets = 0; | 229 | probesWithNoIngressPackets = 0; |
223 | lastPacketsReceived = packetsReceived; | 230 | lastPacketsReceived = packetsReceived; |
@@ -232,7 +239,7 @@ namespace OpenSim.Region.ClientStack | |||
232 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 239 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); |
233 | clientPingTimer.Enabled = true; | 240 | clientPingTimer.Enabled = true; |
234 | 241 | ||
235 | MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to scene"); | 242 | MainLog.Instance.Verbose("OpenSimClient.cs:InitNewClient() - Adding viewer agent to scene"); |
236 | this.m_scene.AddNewClient(this, false); | 243 | this.m_scene.AddNewClient(this, false); |
237 | } | 244 | } |
238 | 245 | ||