[rygel] core: Fix cancellation of SeekableResponse



commit 0d6a3adec6c1817942440a9e4f3962741bdd6f84
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Jan 24 00:11:33 2010 +0200

    core: Fix cancellation of SeekableResponse
    
    We kept on waiting for libsoup to signal us that bytes sent have been
    received by the client even after the client has already closed the
    connection and libsoup had informed us about that.

 src/rygel/rygel-seekable-response.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-seekable-response.vala b/src/rygel/rygel-seekable-response.vala
index cab3353..b171a23 100644
--- a/src/rygel/rygel-seekable-response.vala
+++ b/src/rygel/rygel-seekable-response.vala
@@ -100,6 +100,8 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
     private async void start_reading () {
         try {
             yield this.read_contents ();
+        } catch (IOError.CANCELLED cancelled_err) {
+            // This is OK
         } catch (Error err) {
             warning ("Failed to read contents from URI: %s: %s\n",
                      this.file.get_uri (),
@@ -127,6 +129,11 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
         this.msg.wrote_chunk.connect ((msg) => {
                 cb ();
         });
+        if (this.cancellable != null) {
+            this.cancellable.cancelled.connect (() => {
+                cb ();
+            });
+        }
 
         while (bytes_read > 0) {
             this.push_data (this.buffer, bytes_read);



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