From: Matt S Trout Date: Mon, 14 May 2012 13:28:39 +0000 (+0000) Subject: add call_free/call_discard_free to save a message on future responses X-Git-Tag: v0.001001~61 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8131a88a11a61f4d829e88e609575cf2855f7428;p=scpubgit%2FObject-Remote.git add call_free/call_discard_free to save a message on future responses --- diff --git a/lib/Object/Remote.pm b/lib/Object/Remote.pm index 7bb33c6..a815501 100644 --- a/lib/Object/Remote.pm +++ b/lib/Object/Remote.pm @@ -47,6 +47,12 @@ sub call_discard { $self->connection->send_discard(call => $self->id, $method, @args); } +sub call_discard_free { + my ($self, $method, @args) = @_; + $self->disarm_free; + $self->connection->send_discard(call_free => $self->id, $method, @args); +} + sub _await { my ($self, $future) = @_; my $loop = $self->current_loop; diff --git a/lib/Object/Remote/Connection.pm b/lib/Object/Remote/Connection.pm index 7ab6b1f..09d5712 100644 --- a/lib/Object/Remote/Connection.pm +++ b/lib/Object/Remote/Connection.pm @@ -163,15 +163,21 @@ sub receive_free { sub receive_call { my ($self, $future, $id, @rest) = @_; - $future->{method} = 'call_discard'; + $future->{method} = 'call_discard_free'; my $local = $self->local_objects_by_id->{$id} or do { $future->fail("No such object $id"); return }; $self->_invoke($future, $local, @rest); } +sub receive_call_free { + my ($self, $future, $id, @rest) = @_; + $self->receive_call($future, $id, @rest); + $self->receive_free($id); +} + sub receive_class_call { my ($self, $future, $class, @rest) = @_; - $future->{method} = 'call_discard'; + $future->{method} = 'call_discard_free'; eval { use_module($class) } or do { $future->fail("Error loading ${class}: $@"); return }; $self->_invoke($future, $class, @rest);