From d149d9dce89930bd45f5b07098df72fa13c4e6fd Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 14 May 2012 23:35:59 +0100 Subject: [PATCH] Fix crashes with unavailable notification service --- NEWS | 1 + SparkleLib/SparkleListenerTcp.cs | 4 +--- SparkleLib/SparkleRepoBase.cs | 10 ++++++---- SparkleShare/SparkleControllerBase.cs | 6 +----- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index fc4a5457..1b2057d2 100755 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ - Ship host keys of default plugins and verify on project add - Don't touch the user's ~/.ssh/config to configure SSH - Make fetching remote project's history optional + - Cached logs for faster event log loading/switching 0.8.4 for Linux, Mac and Windows (Sun Mar 18 2012) diff --git a/SparkleLib/SparkleListenerTcp.cs b/SparkleLib/SparkleListenerTcp.cs index 553f7bce..956c9757 100755 --- a/SparkleLib/SparkleListenerTcp.cs +++ b/SparkleLib/SparkleListenerTcp.cs @@ -68,8 +68,7 @@ namespace SparkleLib { try { lock (this.socket_lock) { - this.socket = new Socket (AddressFamily.InterNetwork, - SocketType.Stream, ProtocolType.Tcp) { + this.socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) { ReceiveTimeout = 5 * 1000, SendTimeout = 5 * 1000 }; @@ -164,7 +163,6 @@ namespace SparkleLib { OnDisconnected ("Ping timeout"); return; - } Thread.Sleep (1000); diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index eec7d3f6..4c3bce17 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -175,9 +175,13 @@ namespace SparkleLib { CreateInitialChangeSet (); ChangeSets = GetChangeSets (); - CreateWatcher (); - CreateListener (); + + new Thread ( + new ThreadStart (delegate { + CreateListener (); + }) + ).Start (); this.local_timer.Elapsed += delegate (object o, ElapsedEventArgs args) { CheckForChanges (); @@ -223,8 +227,6 @@ namespace SparkleLib { protected void OnConflictResolved () { - HasUnsyncedChanges = true; // ? - if (ConflictResolved != null) ConflictResolved (); } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index fabd9843..8f26b27e 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -641,11 +641,7 @@ namespace SparkleShare { UpdateState (); }; - - //lock (this.repo_lock) { - this.repositories.Add (repo); - //} - + this.repositories.Add (repo); repo.Initialize (); }