[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
Channel = "#sparkletest";
Server = "irc.gnome.org";
Server = "irc.gnome.orgf";
Client = new IrcClient ();
@ -60,11 +60,11 @@ namespace SparkleLib {
public void Listen ()
{
try {
Thread = new Thread (
new ThreadStart (delegate {
try {
// Connect to the server
Client.Connect (new string [] {Server}, Port);
@ -78,17 +78,17 @@ namespace SparkleLib {
Client.Disconnect ();
})
);
Thread.Start ();
} catch (Exception e) {
} catch ( Meebey.SmartIrc4net.ConnectionException e) {
Console.WriteLine ("Could not connect: " + e.Message);
}
})
);
Thread.Start ();
}
}