[listener] Don't crash on connection error
This commit is contained in:
parent
8b49394384
commit
b99b51cbb9
|
@ -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,11 +60,11 @@ namespace SparkleLib {
|
||||||
public void Listen ()
|
public void Listen ()
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Thread = new Thread (
|
Thread = new Thread (
|
||||||
new ThreadStart (delegate {
|
new ThreadStart (delegate {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
// Connect to the server
|
// Connect to the server
|
||||||
Client.Connect (new string [] {Server}, Port);
|
Client.Connect (new string [] {Server}, Port);
|
||||||
|
|
||||||
|
@ -78,17 +78,17 @@ namespace SparkleLib {
|
||||||
|
|
||||||
Client.Disconnect ();
|
Client.Disconnect ();
|
||||||
|
|
||||||
})
|
} catch ( Meebey.SmartIrc4net.ConnectionException e) {
|
||||||
);
|
|
||||||
|
|
||||||
Thread.Start ();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
Console.WriteLine ("Could not connect: " + e.Message);
|
Console.WriteLine ("Could not connect: " + e.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
Thread.Start ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue