[rygel] core: More reliable way to wait for idle handlers
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: More reliable way to wait for idle handlers
- Date: Thu, 18 Mar 2010 14:09:26 +0000 (UTC)
commit a082475116f0fb1ddaef252c2b8cccf9f4cd999d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Mar 17 16:19:45 2010 +0200
core: More reliable way to wait for idle handlers
Instead of keeping the ID of the last installed idle handler and then
removing it at the end, just add a new idle hander to end the response so
the response is ended after all the idle handlers have been called. This
fixes the issue of LiveResponse not sending all the bytes to the client
before closing the socket on EOS.
src/rygel/rygel-live-response.vala | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-live-response.vala b/src/rygel/rygel-live-response.vala
index c331656..e764fcb 100644
--- a/src/rygel/rygel-live-response.vala
+++ b/src/rygel/rygel-live-response.vala
@@ -33,7 +33,6 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
private HTTPSeek time_range;
- private uint idle_id;
private SourceFunc run_continue;
public LiveResponse (Soup.Server server,
@@ -66,11 +65,6 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
public override void end (bool aborted, uint status) {
this.pipeline.set_state (State.NULL);
- if (this.idle_id != 0) {
- Source.remove (this.idle_id);
- this.idle_id = 0;
- }
-
if (!aborted) {
this.msg.response_body.complete ();
}
@@ -153,12 +147,10 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
private void on_new_buffer (Element sink,
Buffer buffer,
Pad pad) {
- this.idle_id = Idle.add_full (Priority.HIGH_IDLE,
- () => {
+ Idle.add_full (Priority.HIGH_IDLE,
+ () => {
this.push_data (buffer.data, buffer.size);
- this.idle_id = 0;
-
return false;
});
}
@@ -208,7 +200,12 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
}
if (!ret) {
- this.end (false, Soup.KnownStatusCode.NONE);
+ Idle.add_full (Priority.HIGH_IDLE,
+ () => {
+ this.end (false, Soup.KnownStatusCode.NONE);
+
+ return false;
+ });
}
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]