summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Georg <jensg@openismus.com>2012-10-11 16:04:44 +0200
committerJens Georg <jensg@openismus.com>2012-10-29 15:12:16 +0100
commitc6d97adf7e1f3fba974e316d84fa0281aaac3942 (patch)
treee2d8cffa1b9d7e8ad635b217536a5008e5d26cfb /src
parentc8057e923b88e323f4c3d533739b7bf73b652538 (diff)
downloadrygel-c6d97adf7e1f3fba974e316d84fa0281aaac3942.tar.gz
server: Implement ServiceResetToken
Currently it appears as if the server did a Service Reset Procedure (cf. UPnP-av-ContentDirectory-v3-Service.pdf, Section 2.3.7.1, pg 51) when it was shut down.
Diffstat (limited to 'src')
-rw-r--r--src/librygel-core/uuid.vapi10
-rw-r--r--src/librygel-server/rygel-content-directory.vala24
2 files changed, 34 insertions, 0 deletions
diff --git a/src/librygel-core/uuid.vapi b/src/librygel-core/uuid.vapi
index 1279ccc4..914ebaff 100644
--- a/src/librygel-core/uuid.vapi
+++ b/src/librygel-core/uuid.vapi
@@ -4,4 +4,14 @@ namespace UUID {
public static void unparse ([CCode (array_length = false)] uchar[] uuid,
[CCode (array_length = false)] uchar[] output);
+ public static string get () {
+ var id = new uchar[16];
+ var unparsed = new uchar[51];
+
+ UUID.generate (id);
+ UUID.unparse (id, unparsed);
+ unparsed[50] = '\0';
+
+ return (string) unparsed;
+ }
}
diff --git a/src/librygel-server/rygel-content-directory.vala b/src/librygel-server/rygel-content-directory.vala
index 93c8aa85..bfa3f7ce 100644
--- a/src/librygel-server/rygel-content-directory.vala
+++ b/src/librygel-server/rygel-content-directory.vala
@@ -74,6 +74,8 @@ internal class Rygel.ContentDirectory: Service {
private LastChange last_change;
+ private string service_reset_token;
+
public override void constructed () {
this.cancellable = new Cancellable ();
@@ -100,6 +102,8 @@ internal class Rygel.ContentDirectory: Service {
"http://www.upnp.org/schemas/av/avs-v1-20060531.xsd\">" +
"</Features>";
+ this.service_reset_token = UUID.get ();
+
this.action_invoked["Browse"].connect (this.browse_cb);
this.action_invoked["Search"].connect (this.search_cb);
this.action_invoked["CreateObject"].connect (this.create_object_cb);
@@ -140,6 +144,12 @@ internal class Rygel.ContentDirectory: Service {
/* Connect LastChange related signals */
this.query_variable["LastChange"].connect (this.query_last_change);
+ /* Connect ServiceResetToken related signals */
+ this.query_variable["ServiceResetToken"].connect
+ (this.query_service_reset_token);
+ this.action_invoked["GetServiceResetToken"].connect
+ (this.get_service_reset_token_cb);
+
this.http_server.run.begin ();
}
@@ -540,4 +550,18 @@ internal class Rygel.ContentDirectory: Service {
this.last_change.add_event (entry);
}
+
+ /* ServiceResetToken */
+ private void get_service_reset_token_cb (Service content_dir,
+ ServiceAction action) {
+ action.set ("ResetToken", typeof (string), this.service_reset_token);
+ action.return ();
+ }
+
+ private void query_service_reset_token (Service content_dir,
+ string variable,
+ ref GLib.Value value) {
+ value.init (typeof (string));
+ value.set_string (this.service_reset_token);
+ }
}