[rygel] core: Don't try reading file after cancellation



commit 150529bc0b6bdf7c6c18f56cd5555a7e7ce098c4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri May 14 17:28:39 2010 +0300

    core: Don't try reading file after cancellation
    
    When the response is awaken from mainloop, it doesn't necessarily mean
    that pending buffer was pushed to the client but it could also be that
    the response was cancelled, in which case we shouldn't attempt to read
    more bytes from file anymore.

 src/rygel/rygel-seekable-response.vala |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-seekable-response.vala b/src/rygel/rygel-seekable-response.vala
index e88e9b0..7718c39 100644
--- a/src/rygel/rygel-seekable-response.vala
+++ b/src/rygel/rygel-seekable-response.vala
@@ -133,6 +133,10 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
             // and the handler we installed before the loop is called for it.
             yield;
 
+            if (this.cancellable != null && this.cancellable.is_cancelled ()) {
+                break;
+            }
+
             bytes_read = yield this.input_stream.read_async (
                                         this.buffer,
                                         this.bytes_to_read (),



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