summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:42:19 +0000
committerfcolin2007-02-01 09:42:19 +0000
commitc6b4d43624cf5d48d15ccec6fbadb74e7617955a (patch)
tree8ec5a33b9f8016cce2d6059e88ae63cad3518f2c
parenta670e5ab0f8f7bc2eb1100b1c391d92f1fa36147 (diff)
downloadivy-csharp-c6b4d43624cf5d48d15ccec6fbadb74e7617955a.zip
ivy-csharp-c6b4d43624cf5d48d15ccec6fbadb74e7617955a.tar.gz
ivy-csharp-c6b4d43624cf5d48d15ccec6fbadb74e7617955a.tar.bz2
ivy-csharp-c6b4d43624cf5d48d15ccec6fbadb74e7617955a.tar.xz
Utilisateur : Fcolin Date : 4/11/03 Heure : 18:07 Archivé dans $/EScribe/Ivy Commentaire: (vss 11)
-rw-r--r--CSharp/Ivy/Ivy/Ivy.cs25
1 files changed, 20 insertions, 5 deletions
diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs
index 60c3ff4..56aa68c 100644
--- a/CSharp/Ivy/Ivy/Ivy.cs
+++ b/CSharp/Ivy/Ivy/Ivy.cs
@@ -56,6 +56,10 @@ namespace IvyBus
{
return debug;
}
+ set
+ {
+ debug = value;
+ }
}
/// <summary>ClientNames accesses the name list of the connected clients</summary>
@@ -137,7 +141,7 @@ namespace IvyBus
{
callbacks = new Hashtable();
clients = Hashtable.Synchronized( new Hashtable() );
- regexp_out = new Hashtable();
+ regexp_out = Hashtable.Synchronized( new Hashtable());
appName = name;
ready_message = message;
String debug_str = ConfigurationSettings.AppSettings["IVY_DEBUG"];
@@ -249,14 +253,19 @@ namespace IvyBus
((IvyWatcher) watchers[i]).stop();
}
// stopping the remaining IvyClients
+ // copy the values in temporary variable to eliminate Thread modifying collection
+ IvyClient[] copyClient;
+ copyClient = new IvyClient[clients.Count];
lock( clients.SyncRoot )
{
- foreach (IvyClient c in clients.Values )
+ clients.Values.CopyTo( copyClient,0 );
+ }
+ foreach (IvyClient client in copyClient )
{
- c.close(true); // will notify the reading thread
- //removeClient(c); already donne in the thread
+ client.close(true); // will notify the reading thread
+ //removeClient(client); already donne in the thread
}
- }
+
}
catch (IOException e)
{
@@ -594,6 +603,12 @@ namespace IvyBus
Console.Out.WriteLine("Ivy server socket reader caught an exception " + e.Message);
// e.printStackTrace();
}
+ catch (ThreadInterruptedException te)
+ {
+ Console.Error.WriteLine( te.Message );
+ Console.Error.WriteLine( te.StackTrace);
+ running = false;
+ }
catch (SocketException e)
{
traceDebug("my server socket has been closed");