diff options
-rw-r--r-- | CSharp/Ivy/Ivy/Ivy.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index ec4e401..7d648e0 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -109,18 +109,10 @@ namespace IvyBus {
public MyTcpListener(IPAddress address, int port) : base(address, port)
{
- //Socket s = this.Server;
- // set Listen MaxConnections to 10 .
- //IPOptions lingerOption = new IPOptions (true, 10);
-
- //s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MaxConnections , 10 );
}
- public void WaitForActive()
+ public bool IsActive()
{
- while( ! this.Active )
- {
- Thread.Sleep( 50 );
- }
+ return this.Active;
}
@@ -235,7 +227,12 @@ namespace IvyBus serverThread = new Thread(new ThreadStart(this.Run));
serverThread.Name = "Ivy Tcp Server Thread";
serverThread.Start();
- app.WaitForActive();
+ // Wait for readyness
+ while ( serverThread.ThreadState != ThreadState.Running || !app.IsActive())
+ {
+ Console.WriteLine( " Ivy Threading start in progress..." );
+ Thread.Sleep( 100 );
+ }
// sends the broadcasts and listen to incoming connexions
for (int i = 0; i < watchers.Count; i++)
{
|