[rygel] core: Remove item if HTTP POST is aborted



commit cde47cb1f22c5909e7a5b2637cb7a0babfc4c872
Author: Topi Santakivi <topi santakivi digia com>
Date:   Fri May 20 12:28:38 2011 +0300

    core: Remove item if HTTP POST is aborted

 src/rygel/rygel-http-post.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-http-post.vala b/src/rygel/rygel-http-post.vala
index 66b83e7..e0a3590 100644
--- a/src/rygel/rygel-http-post.vala
+++ b/src/rygel/rygel-http-post.vala
@@ -38,6 +38,8 @@ internal class Rygel.HTTPPost : HTTPRequest {
                      Soup.Server  server,
                      Soup.Message msg) {
         base (http_server, server, msg);
+
+        this.cancellable.connect (this.on_request_cancelled);
     }
 
     protected override async void handle () throws Error {
@@ -134,5 +136,14 @@ internal class Rygel.HTTPPost : HTTPRequest {
             this.handle_continue ();
         }
     }
+
+    private void on_request_cancelled () {
+        this.remove_item.begin ();
+    }
+
+    private async void remove_item () {
+        var queue = ItemRemovalQueue.get_default ();
+        yield queue.remove_now (this.item, null);
+    }
 }
 



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