diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index e199f30..be9917c 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -73,7 +73,6 @@ namespace OpenSim.Region.ClientStack | |||
73 | private uint m_circuitCode; | 73 | private uint m_circuitCode; |
74 | private int m_moneyBalance; | 74 | private int m_moneyBalance; |
75 | 75 | ||
76 | |||
77 | private byte[] m_channelVersion=new byte[] { 0x00} ; // Dummy value needed by libSL | 76 | private byte[] m_channelVersion=new byte[] { 0x00} ; // Dummy value needed by libSL |
78 | 77 | ||
79 | /* protected variables */ | 78 | /* protected variables */ |
@@ -188,11 +187,6 @@ namespace OpenSim.Region.ClientStack | |||
188 | 187 | ||
189 | PacketQueue = new PacketQueue(); | 188 | PacketQueue = new PacketQueue(); |
190 | 189 | ||
191 | //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); | ||
192 | AckTimer = new Timer(750); | ||
193 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | ||
194 | AckTimer.Start(); | ||
195 | |||
196 | RegisterLocalPacketHandlers(); | 190 | RegisterLocalPacketHandlers(); |
197 | 191 | ||
198 | ClientThread = new Thread(new ThreadStart(AuthUser)); | 192 | ClientThread = new Thread(new ThreadStart(AuthUser)); |
@@ -211,18 +205,29 @@ namespace OpenSim.Region.ClientStack | |||
211 | 205 | ||
212 | public void Close() | 206 | public void Close() |
213 | { | 207 | { |
214 | // FLUSH Packets | ||
215 | PacketQueue.Flush(); | ||
216 | PacketQueue.Close(); | ||
217 | |||
218 | // Pull Client out of Region | 208 | // Pull Client out of Region |
219 | m_scene.RemoveClient(AgentId); | 209 | m_scene.RemoveClient(AgentId); |
210 | |||
211 | // Send the STOP packet | ||
212 | libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); | ||
213 | OutPacket(disable, ThrottleOutPacketType.Task); | ||
214 | |||
215 | // FLUSH Packets | ||
216 | PacketQueue.Close(); | ||
217 | PacketQueue.Flush(); | ||
220 | 218 | ||
221 | // Shut down timers | 219 | // Shut down timers |
220 | AckTimer.Stop(); | ||
222 | clientPingTimer.Stop(); | 221 | clientPingTimer.Stop(); |
222 | |||
223 | // This is just to give the client a reasonable chance of | ||
224 | // flushing out all it's packets. There should probably | ||
225 | // be a better mechanism here | ||
226 | Thread.Sleep(2000); | ||
223 | 227 | ||
224 | ClientThread.Abort(); | 228 | ClientThread.Abort(); |
225 | } | 229 | } |
230 | |||
226 | public void Kick(string message) | 231 | public void Kick(string message) |
227 | { | 232 | { |
228 | KickUserPacket kupack = new KickUserPacket(); | 233 | KickUserPacket kupack = new KickUserPacket(); |
@@ -234,17 +239,11 @@ namespace OpenSim.Region.ClientStack | |||
234 | kupack.TargetBlock.TargetPort = (ushort)0; | 239 | kupack.TargetBlock.TargetPort = (ushort)0; |
235 | kupack.UserInfo.Reason = Helpers.StringToField(message); | 240 | kupack.UserInfo.Reason = Helpers.StringToField(message); |
236 | OutPacket(kupack, ThrottleOutPacketType.Task); | 241 | OutPacket(kupack, ThrottleOutPacketType.Task); |
237 | |||
238 | |||
239 | } | 242 | } |
243 | |||
240 | public void Stop() | 244 | public void Stop() |
241 | { | 245 | { |
242 | clientPingTimer.Stop(); | 246 | Close(); |
243 | |||
244 | libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); | ||
245 | OutPacket(disable, ThrottleOutPacketType.Task); | ||
246 | |||
247 | ClientThread.Abort(); | ||
248 | } | 247 | } |
249 | 248 | ||
250 | #endregion | 249 | #endregion |
@@ -389,6 +388,13 @@ namespace OpenSim.Region.ClientStack | |||
389 | 388 | ||
390 | protected virtual void InitNewClient() | 389 | protected virtual void InitNewClient() |
391 | { | 390 | { |
391 | //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); | ||
392 | |||
393 | // Establish our two timers. We could probably get this down to one | ||
394 | AckTimer = new Timer(750); | ||
395 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | ||
396 | AckTimer.Start(); | ||
397 | |||
392 | clientPingTimer = new Timer(5000); | 398 | clientPingTimer = new Timer(5000); |
393 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 399 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); |
394 | clientPingTimer.Enabled = true; | 400 | clientPingTimer.Enabled = true; |
@@ -407,6 +413,7 @@ namespace OpenSim.Region.ClientStack | |||
407 | { | 413 | { |
408 | //session/circuit not authorised | 414 | //session/circuit not authorised |
409 | MainLog.Instance.Notice("CLIENT", "New user request denied to " + userEP.ToString()); | 415 | MainLog.Instance.Notice("CLIENT", "New user request denied to " + userEP.ToString()); |
416 | PacketQueue.Close(); | ||
410 | ClientThread.Abort(); | 417 | ClientThread.Abort(); |
411 | } | 418 | } |
412 | else | 419 | else |
@@ -423,6 +430,7 @@ namespace OpenSim.Region.ClientStack | |||
423 | { | 430 | { |
424 | m_secureSessionId = sessionInfo.LoginInfo.SecureSession; | 431 | m_secureSessionId = sessionInfo.LoginInfo.SecureSession; |
425 | } | 432 | } |
433 | // This sets up all the timers | ||
426 | InitNewClient(); | 434 | InitNewClient(); |
427 | 435 | ||
428 | ClientLoop(); | 436 | ClientLoop(); |
@@ -431,11 +439,6 @@ namespace OpenSim.Region.ClientStack | |||
431 | 439 | ||
432 | # endregion | 440 | # endregion |
433 | 441 | ||
434 | protected void KillThread() | ||
435 | { | ||
436 | ClientThread.Abort(); | ||
437 | } | ||
438 | |||
439 | // Previously ClientView.API partial class | 442 | // Previously ClientView.API partial class |
440 | public event Action<IClientAPI> OnLogout; | 443 | public event Action<IClientAPI> OnLogout; |
441 | public event ObjectPermissions OnObjectPermissions; | 444 | public event ObjectPermissions OnObjectPermissions; |
@@ -2171,7 +2174,7 @@ namespace OpenSim.Region.ClientStack | |||
2171 | "ClientView.PacketQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + | 2174 | "ClientView.PacketQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + |
2172 | userEP.ToString() + " - killing thread"); | 2175 | userEP.ToString() + " - killing thread"); |
2173 | MainLog.Instance.Error(e.ToString()); | 2176 | MainLog.Instance.Error(e.ToString()); |
2174 | KillThread(); | 2177 | Close(); |
2175 | } | 2178 | } |
2176 | } | 2179 | } |
2177 | 2180 | ||