[listener] Don't crash on connection error

This commit is contained in:
Hylke Bons 2010-09-12 23:29:26 +01:00
parent 8b49394384
commit b99b51cbb9

View file

@ -45,7 +45,7 @@ namespace SparkleLib {
// TODO: Remove these hardcoded values // TODO: Remove these hardcoded values
Channel = "#sparkletest"; Channel = "#sparkletest";
Server = "irc.gnome.org"; Server = "irc.gnome.orgf";
Client = new IrcClient (); Client = new IrcClient ();
@ -60,10 +60,10 @@ namespace SparkleLib {
public void Listen () public void Listen ()
{ {
try { Thread = new Thread (
new ThreadStart (delegate {
Thread = new Thread ( try {
new ThreadStart (delegate {
// Connect to the server // Connect to the server
Client.Connect (new string [] {Server}, Port); Client.Connect (new string [] {Server}, Port);
@ -78,16 +78,16 @@ namespace SparkleLib {
Client.Disconnect (); 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 ();
} }