diff --git a/SparkleLib/SparkleListener.cs b/SparkleLib/SparkleListener.cs index 19c5b38c..fecf0f66 100644 --- a/SparkleLib/SparkleListener.cs +++ b/SparkleLib/SparkleListener.cs @@ -22,10 +22,12 @@ using System.Threading; namespace SparkleLib { + // A persistent connection to the server that + // listens for change notifications public class SparkleListener { - // FIXME: The irc client is a public property because + // FIXME: The IrcClient is a public property because // extending it causes crashes public IrcClient Client; private Thread Thread; @@ -49,9 +51,12 @@ namespace SparkleLib { Server = "irc.gnome.org"; Client = new IrcClient () { - PingTimeout = 90, - SocketSendTimeout = 90, - SocketReceiveTimeout = 90 + PingTimeout = 60, + SocketSendTimeout = 60, + SocketReceiveTimeout = 60, + AutoRetry = true, + AutoReconnect = true, + AutoRejoin = true }; } @@ -93,6 +98,7 @@ namespace SparkleLib { } + // Frees all resources for this Listener public void Dispose () { diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs index bcde2e02..4b4ead33 100644 --- a/SparkleLib/SparkleRepo.cs +++ b/SparkleLib/SparkleRepo.cs @@ -264,7 +264,7 @@ namespace SparkleLib { _UserName = GetUserName (); _UserEmail = GetUserEmail (); - _CurrentHash = GetCurrentHash (); + _CurrentHash = GetCurrentHash (); _HasUnsyncedChanges = false; _IsSyncing = false; _IsBuffering = false; @@ -297,6 +297,10 @@ namespace SparkleLib { Interval = 60000 }; + + // Listen to the irc channel on the server + Listener = new SparkleListener (Domain, "#" + RemoteName, _UserEmail); + RemoteTimer.Elapsed += delegate { CheckForRemoteChanges (); @@ -304,10 +308,14 @@ namespace SparkleLib { if (_HasUnsyncedChanges) Push (); - }; + if (!Listener.Client.IsConnected) { - // Listen to the irc channel on the server - Listener = new SparkleListener (Domain, "#" + RemoteName, _UserEmail); + SparkleHelpers.DebugInfo ("Irc", "[" + Name + "] Trying to reconnect..."); + Listener.Client.Reconnect (true, true); + + } + + }; // Stop polling when the connection to the irc channel is succesful Listener.Client.OnConnected += delegate { diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 70c32aec..c0e7a907 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -25,6 +25,8 @@ using System.Timers; namespace SparkleShare { + // The statusicon that stays in the + // user's notification area public class SparkleStatusIcon : StatusIcon {