From b99b51cbb913ce36d2379356e972711fd9413bf9 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 12 Sep 2010 23:29:26 +0100 Subject: [PATCH] [listener] Don't crash on connection error --- SparkleLib/SparkleListener.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SparkleLib/SparkleListener.cs b/SparkleLib/SparkleListener.cs index addad4ac..8d8f0413 100644 --- a/SparkleLib/SparkleListener.cs +++ b/SparkleLib/SparkleListener.cs @@ -45,7 +45,7 @@ namespace SparkleLib { // TODO: Remove these hardcoded values Channel = "#sparkletest"; - Server = "irc.gnome.org"; + Server = "irc.gnome.orgf"; Client = new IrcClient (); @@ -60,10 +60,10 @@ namespace SparkleLib { public void Listen () { - try { + Thread = new Thread ( + new ThreadStart (delegate { - Thread = new Thread ( - new ThreadStart (delegate { + try { // Connect to the server Client.Connect (new string [] {Server}, Port); @@ -78,16 +78,16 @@ namespace SparkleLib { Client.Disconnect (); - }) - ); + } catch ( Meebey.SmartIrc4net.ConnectionException e) { - Thread.Start (); + Console.WriteLine ("Could not connect: " + e.Message); - } catch (Exception e) { + } - Console.WriteLine ("Could not connect: " + e.Message); + }) + ); - } + Thread.Start (); }