[rygel] core: SeekableResponse is always given a seek request



commit 6ac02165ca2675f77d7abb8158b9314689163d46
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri May 14 15:28:01 2010 +0300

    core: SeekableResponse is always given a seek request
    
    After commit ce7f5c0d we must not keep the seek construction parameter
    optional and we don't need to check if there is a seek request or not.

 src/rygel/rygel-seekable-response.vala |   44 +++++++++++++-------------------
 1 files changed, 18 insertions(+), 26 deletions(-)
---
diff --git a/src/rygel/rygel-seekable-response.vala b/src/rygel/rygel-seekable-response.vala
index 4909fa9..e16a9ab 100644
--- a/src/rygel/rygel-seekable-response.vala
+++ b/src/rygel/rygel-seekable-response.vala
@@ -39,22 +39,16 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
     public SeekableResponse (Soup.Server  server,
                              Soup.Message msg,
                              string       uri,
-                             HTTPSeek?    seek,
+                             HTTPSeek     seek,
                              size_t       file_length,
                              Cancellable? cancellable) {
-        var partial = seek != null && seek.length < file_length;
+        var partial = seek.length < file_length;
 
         base (server, msg, partial, cancellable);
 
         this.seek = seek;
-        this.total_length = file_length;
         this.priority = this.get_requested_priority ();
-
-        if (seek != null) {
-            this.total_length = (size_t) seek.length;
-        } else {
-            this.total_length = file_length;
-        }
+        this.total_length = (size_t) seek.length;
 
         this.buffer = new char[SeekableResponse.BUFFER_LENGTH];
         this.file = File.new_for_uri (uri);
@@ -77,23 +71,21 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
     }
 
     private async void perform_seek () {
-        if (this.seek != null) {
-            try {
-                this.input_stream.seek (this.seek.start,
-                                        SeekType.SET,
-                                        this.cancellable);
-            } catch (Error err) {
-                // Failed to seek to media segment (defined by first and last
-                // byte positions).
-                warning (_("Failed to seek to %s-%s on URI %s: %s"),
-                         seek.start.to_string (),
-                         seek.stop.to_string (),
-                         file.get_uri (),
-                         err.message);
-                this.end (false,
-                          Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
-                return;
-            }
+        try {
+            this.input_stream.seek (this.seek.start,
+                                    SeekType.SET,
+                                    this.cancellable);
+        } catch (Error err) {
+            // Failed to seek to media segment (defined by first and last
+            // byte positions).
+            warning (_("Failed to seek to %s-%s on URI %s: %s"),
+                     seek.start.to_string (),
+                     seek.stop.to_string (),
+                     file.get_uri (),
+                     err.message);
+            this.end (false,
+                      Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
+            return;
         }
 
         yield this.start_reading ();



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