rygel r451 - trunk/src/rygel



Author: zeeshanak
Date: Sun Jan 18 19:27:54 2009
New Revision: 451
URL: http://svn.gnome.org/viewvc/rygel?rev=451&view=rev

Log:
HTTPResponse.end takes HTTP status code to put on the message.

This is to allow the users/subclasses to be always able to end the stream
using the same single method.

Modified:
   trunk/src/rygel/rygel-http-response.vala
   trunk/src/rygel/rygel-interactive-response.vala
   trunk/src/rygel/rygel-streaming-response.vala

Modified: trunk/src/rygel/rygel-http-response.vala
==============================================================================
--- trunk/src/rygel/rygel-http-response.vala	(original)
+++ trunk/src/rygel/rygel-http-response.vala	Sun Jan 18 19:27:54 2009
@@ -53,7 +53,7 @@
                                      Soup.ClientContext client) {
         // Ignore if message isn't ours
         if (msg == this.msg)
-            this.end (true);
+            this.end (true, Soup.KnownStatusCode.NONE);
     }
 
     public void set_mime_type (string mime_type) {
@@ -68,7 +68,11 @@
         this.server.unpause_message (this.msg);
     }
 
-    public virtual void end (bool aborted) {
+    public virtual void end (bool aborted, uint status) {
+        if (status != Soup.KnownStatusCode.NONE) {
+            this.msg.set_status (status);
+        }
+
         this.ended ();
     }
 }

Modified: trunk/src/rygel/rygel-interactive-response.vala
==============================================================================
--- trunk/src/rygel/rygel-interactive-response.vala	(original)
+++ trunk/src/rygel/rygel-interactive-response.vala	Sun Jan 18 19:27:54 2009
@@ -66,7 +66,7 @@
             warning ("Failed to read from URI: %s: %s\n",
                      file.get_uri (),
                      err.message);
-            this.msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
+            this.end (false, Soup.KnownStatusCode.NOT_FOUND);
             return;
         }
 
@@ -79,8 +79,8 @@
                          seek.stop.to_string (),
                          file.get_uri (),
                          err.message);
-                this.msg.set_status (
-                         Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
+                this.end (false,
+                          Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
                 return;
             }
         }
@@ -104,12 +104,12 @@
             warning ("Failed to read contents from URI: %s: %s\n",
                      this.file.get_uri (),
                      err.message);
-            this.msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
+            this.end (false, Soup.KnownStatusCode.NOT_FOUND);
             return;
         }
 
         this.push_data (this.buffer, this.length);
-        this.end (false);
+        this.end (false, Soup.KnownStatusCode.NONE);
     }
 }
 

Modified: trunk/src/rygel/rygel-streaming-response.vala
==============================================================================
--- trunk/src/rygel/rygel-streaming-response.vala	(original)
+++ trunk/src/rygel/rygel-streaming-response.vala	Sun Jan 18 19:27:54 2009
@@ -60,7 +60,7 @@
         this.pipeline.set_state (State.PLAYING);
     }
 
-    public override void end (bool aborted) {
+    public override void end (bool aborted, uint status) {
         this.pipeline.set_state (State.NULL);
         // Flush the queue of buffers
         Buffer buffer = null;
@@ -72,7 +72,7 @@
             this.msg.response_body.complete ();
         }
 
-        base.end (aborted);
+        base.end (aborted, status);
     }
 
     private void prepare_pipeline (string name,
@@ -124,7 +124,7 @@
                 critical ("Failed to link %s to %s",
                           depay.name,
                           sink.name);
-                this.end (false);
+                this.end (false, Soup.KnownStatusCode.NONE);
                 return;
             }
 
@@ -137,7 +137,7 @@
             critical ("Failed to link pad %s to %s",
                       src_pad.name,
                       sink_pad.name);
-            this.end (false);
+            this.end (false, Soup.KnownStatusCode.NONE);
             return;
         }
 
@@ -248,7 +248,7 @@
         }
 
         if (!ret) {
-            this.end (false);
+            this.end (false, Soup.KnownStatusCode.NONE);
         }
 
         return ret;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]