summaryrefslogtreecommitdiff
path: root/CSharp/Ivy
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:54:18 +0000
committerfcolin2007-02-01 09:54:18 +0000
commit37d6c91f90d2c952c772ea4ea013f16d91edadef (patch)
treeb32223d34777be145d2a97da4a837c3f6d05b8d6 /CSharp/Ivy
parent1455a16414ddc25eb9833a4969426f12f5b5028b (diff)
downloadivy-csharp-37d6c91f90d2c952c772ea4ea013f16d91edadef.zip
ivy-csharp-37d6c91f90d2c952c772ea4ea013f16d91edadef.tar.gz
ivy-csharp-37d6c91f90d2c952c772ea4ea013f16d91edadef.tar.bz2
ivy-csharp-37d6c91f90d2c952c772ea4ea013f16d91edadef.tar.xz
Utilisateur : Fcolin Date : 4/11/03 Heure : 18:07 Archivé dans $/EScribe/Ivy Commentaire: (vss 11)
Diffstat (limited to 'CSharp/Ivy')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs25
1 files changed, 20 insertions, 5 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 60c3ff4..56aa68c 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/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");