X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTak%2FConnectionReceiver.pm;h=fe3c33f2be6b5be4e91f76c194f9f9273bc0a034;hb=986f5290d9338118f95f2293f705368fb142d270;hp=bb2ba151b9404ccee427cc400d28603bcbb68ad5;hpb=77bf1d9b5b6832894676ab549ee5664cb7200d33;p=scpubgit%2FTak.git diff --git a/lib/Tak/ConnectionReceiver.pm b/lib/Tak/ConnectionReceiver.pm index bb2ba15..fe3c33f 100644 --- a/lib/Tak/ConnectionReceiver.pm +++ b/lib/Tak/ConnectionReceiver.pm @@ -12,6 +12,8 @@ has channel => (is => 'ro', required => 1); has service => (is => 'ro', required => 1); +has on_close => (is => 'ro', required => 1); + sub BUILD { weaken(my $self = shift); my $channel = $self->channel; @@ -51,7 +53,7 @@ sub receive_progress { sub receive_result { my ($self, $tag, @payload) = @_; - $self->requests->{$tag}->result(@payload); + (delete $self->requests->{$tag})->result(@payload); } sub receive_message { @@ -59,4 +61,9 @@ sub receive_message { $self->service->receive(@payload); } +sub receive_close { + my ($self, @payload) = @_; + $self->on_close->(@payload); +} + 1;