core: Don't try reading file after cancellation
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 14 May 2010 14:28:39 +0000 (17:28 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 14 May 2010 16:01:48 +0000 (19:01 +0300)
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

index e88e9b0..7718c39 100644 (file)
@@ -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 (),