[banshee] Daap: Always send revision-number in update requests (bgo#659146)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Daap: Always send revision-number in update requests (bgo#659146)
- Date: Sat, 17 Mar 2012 17:19:45 +0000 (UTC)
commit b763092998c5aa628661b178bdd9faf12a0341a8
Author: Nuno Araujo <nuno araujo russo79 com>
Date: Sat Mar 17 01:19:25 2012 +0100
Daap: Always send revision-number in update requests (bgo#659146)
Some DAAP servers (e.g. forked-daapd) don't accept update requests
which don't provide a revision-number.
In those cases, Banshee throws a Daap.ContentException with the message:
Could not find root node 'dmap.serverrevision'
Other DAAP clients (e.g. Rhythmbox) send the first update request with
an initial value of 1 for the revision-number. This patch makes Banshee
have the same behaviour.
Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>
src/Extensions/Banshee.Daap/Daap/Client.cs | 13 +++----------
src/Extensions/Banshee.Daap/Daap/Database.cs | 2 +-
2 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/Extensions/Banshee.Daap/Daap/Client.cs b/src/Extensions/Banshee.Daap/Daap/Client.cs
index bd3f32f..725db9a 100644
--- a/src/Extensions/Banshee.Daap/Daap/Client.cs
+++ b/src/Extensions/Banshee.Daap/Daap/Client.cs
@@ -31,6 +31,7 @@ using System.Collections.ObjectModel;
namespace Daap {
public class Client : IDisposable {
+ public const int InitialRevision = 1;
private const int UpdateSleepInterval = 2 * 60 * 1000; // 2 minutes
private IPAddress address;
@@ -39,7 +40,7 @@ namespace Daap {
private ServerInfo serverInfo;
private List<Database> databases = new List<Database> ();
private ContentFetcher fetcher;
- private int revision;
+ private int revision = InitialRevision;
private bool updateRunning;
public event EventHandler Updated;
@@ -171,11 +172,6 @@ namespace Daap {
}
}
- private int GetCurrentRevision () {
- ContentNode revNode = ContentParser.Parse (bag, fetcher.Fetch ("/update"), "dmap.serverrevision");
- return (int) revNode.Value;
- }
-
private int WaitForRevision (int currentRevision) {
ContentNode revNode = ContentParser.Parse (bag, fetcher.Fetch ("/update",
"revision-number=" + currentRevision));
@@ -187,10 +183,7 @@ namespace Daap {
int newrev = revision;
if (serverInfo.SupportsUpdate) {
- if (revision == 0)
- newrev = GetCurrentRevision ();
- else
- newrev = WaitForRevision (revision);
+ newrev = WaitForRevision (revision);
if (newrev == revision)
return;
diff --git a/src/Extensions/Banshee.Daap/Daap/Database.cs b/src/Extensions/Banshee.Daap/Daap/Database.cs
index 0c4dd11..711c1c3 100644
--- a/src/Extensions/Banshee.Daap/Daap/Database.cs
+++ b/src/Extensions/Banshee.Daap/Daap/Database.cs
@@ -390,7 +390,7 @@ namespace Daap {
string revquery = null;
- if (client.Revision != 0)
+ if (client.Revision != Client.InitialRevision)
revquery = String.Format ("revision-number={0}&delta={1}", newrev, newrev - client.Revision);
RefreshTracks (revquery);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]