From d71f44c55f30ececeec998079d2dbc53d17df6a1 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 25 Oct 2006 21:22:18 +0000 Subject: [PATCH] Removed all the trailing residue from the mutexes, fixed a Logout bug with closing the sim socket git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@395 52acb1d6-8a22-11de-b505-999d5b087335 --- libsecondlife-cs/AvatarManager.cs | 1 - libsecondlife-cs/GroupManager.cs | 1 - libsecondlife-cs/NetworkManager.cs | 9 +++++---- libsecondlife-cs/SecondLife.cs | 1 - .../examples/botmanager/botmanager.cs | 1 - .../examples/slaccountant/frmSLAccountant.cs | 19 +++++++------------ libsecondlife-cs/tests/DebugServer.cs | 2 +- 7 files changed, 13 insertions(+), 21 deletions(-) diff --git a/libsecondlife-cs/AvatarManager.cs b/libsecondlife-cs/AvatarManager.cs index 4d040f09..9b29a86c 100644 --- a/libsecondlife-cs/AvatarManager.cs +++ b/libsecondlife-cs/AvatarManager.cs @@ -26,7 +26,6 @@ using System; using System.Collections.Generic; -using System.Threading; using libsecondlife.Packets; namespace libsecondlife diff --git a/libsecondlife-cs/GroupManager.cs b/libsecondlife-cs/GroupManager.cs index ecbd6934..26480477 100644 --- a/libsecondlife-cs/GroupManager.cs +++ b/libsecondlife-cs/GroupManager.cs @@ -26,7 +26,6 @@ using System; using System.Collections.Generic; -using System.Threading; using libsecondlife.Packets; namespace libsecondlife diff --git a/libsecondlife-cs/NetworkManager.cs b/libsecondlife-cs/NetworkManager.cs index e9d9d29c..d654798d 100644 --- a/libsecondlife-cs/NetworkManager.cs +++ b/libsecondlife-cs/NetworkManager.cs @@ -30,7 +30,6 @@ using System.Timers; using System.Collections.Generic; using System.Net; using System.Net.Sockets; -using System.Threading; using System.Security.Cryptography; using Nwc.XmlRpc; using Nii.JSON; @@ -205,7 +204,7 @@ namespace libsecondlife { return; } - Thread.Sleep(10); + System.Threading.Thread.Sleep(10); } } catch (Exception e) @@ -380,8 +379,8 @@ namespace libsecondlife } catch (SocketException) { - Client.Log("Socket error, shutting down " + this.Region.Name + - " (" + endPoint.ToString() + ")", Helpers.LogLevel.Error); + Client.Log(endPoint.ToString() + " socket is closed, shutting down " + this.Region.Name, + Helpers.LogLevel.Info); connected = false; Network.DisconnectSim(this); @@ -989,6 +988,8 @@ namespace libsecondlife return; } + Client.Log("Logging out", Helpers.LogLevel.Info); + DisconnectTimer.Stop(); connected = false; diff --git a/libsecondlife-cs/SecondLife.cs b/libsecondlife-cs/SecondLife.cs index ba973f95..3d586916 100644 --- a/libsecondlife-cs/SecondLife.cs +++ b/libsecondlife-cs/SecondLife.cs @@ -26,7 +26,6 @@ using System; using System.Collections.Generic; -using System.Threading; using libsecondlife.Packets; namespace libsecondlife diff --git a/libsecondlife-cs/examples/botmanager/botmanager.cs b/libsecondlife-cs/examples/botmanager/botmanager.cs index 3a899a97..8d3fc3f3 100644 --- a/libsecondlife-cs/examples/botmanager/botmanager.cs +++ b/libsecondlife-cs/examples/botmanager/botmanager.cs @@ -26,7 +26,6 @@ using System; using System.Collections.Generic; -using System.Threading; using libsecondlife; using libsecondlife.Packets; diff --git a/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs b/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs index fd397d70..06d7fcd3 100644 --- a/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs +++ b/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using System.Data; -using System.Threading; using libsecondlife; using libsecondlife.Packets; @@ -70,8 +69,6 @@ namespace SLAccountant // libsecondlife instance private SecondLife client; - // Mutex for locking the listview - Mutex lstFindMutex; public frmSLAccountant() { @@ -366,23 +363,21 @@ namespace SLAccountant { DirPeopleReplyPacket reply = (DirPeopleReplyPacket)packet; - lstFindMutex.WaitOne(); - - foreach (DirPeopleReplyPacket.QueryRepliesBlock block in reply.QueryReplies) + lock (lstFind) { - ListViewItem listItem = new ListViewItem(new string[] { + + foreach (DirPeopleReplyPacket.QueryRepliesBlock block in reply.QueryReplies) + { + ListViewItem listItem = new ListViewItem(new string[] { Helpers.FieldToString(block.FirstName) + " " + Helpers.FieldToString(block.LastName), (block.Online ? "Yes" : "No"), block.AgentID.ToString() }); - lstFind.Items.Add(listItem); + lstFind.Items.Add(listItem); + } } - - lstFindMutex.ReleaseMutex(); } private void frmSLAccountant_Load(object sender, System.EventArgs e) { - lstFindMutex = new Mutex(false, "lstFindMutex"); - client = new SecondLife(); // Install our packet handlers diff --git a/libsecondlife-cs/tests/DebugServer.cs b/libsecondlife-cs/tests/DebugServer.cs index 4d866559..f2986168 100644 --- a/libsecondlife-cs/tests/DebugServer.cs +++ b/libsecondlife-cs/tests/DebugServer.cs @@ -4,8 +4,8 @@ using System.IO; using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; -using System.Threading; using System.Xml; +using System.Threading; using Nwc.XmlRpc; using libsecondlife; using libsecondlife.Packets;