This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Tarantool -- an efficient key/value data store".

The branch perl-iproto-async has been updated
       via  493a2335d3538984190c56f34579d9a4f539a5ab (commit)
      from  54611269f1628e23c451cfa0f165f51528264e5b (commit)

Summary of changes:
 .../client/perl/lib/MR/IProto/Connection/Async.pm  |   26 +++++++++++++++++--
 1 files changed, 23 insertions(+), 3 deletions(-)

commit 493a2335d3538984190c56f34579d9a4f539a5ab
Author: Aleksey Mashanov <[email protected]>
Date:   Wed Dec 1 10:56:09 2010 +0300

    https://sys.mail.ru/task_viewer.php?id=761758
    Run callback only after no-reply request was sent.

diff --git a/mod/silverbox/client/perl/lib/MR/IProto/Connection/Async.pm 
b/mod/silverbox/client/perl/lib/MR/IProto/Connection/Async.pm
index af1a2e9..9f12c9c 100644
--- a/mod/silverbox/client/perl/lib/MR/IProto/Connection/Async.pm
+++ b/mod/silverbox/client/perl/lib/MR/IProto/Connection/Async.pm
@@ -46,6 +46,12 @@ has _read_reply => (
     lazy_build => 1,
 );
 
+has _no_reply => (
+    is  => 'ro',
+    isa => 'ArrayRef',
+    lazy_build => 1,
+);
+
 =head1 PUBLIC METHODS
 
 =over
@@ -98,9 +104,7 @@ sub _send {
     $self->_debug_dump(5, 'send payload: ', $payload);
     $self->_handle->push_write( $header . $payload );
     if( $no_reply ) {
-        $self->_recv_finished($sync, undef, undef);
-        $self->_try_to_send();
-        delete($self->_callbacks->{$sync})->(undef, undef);
+        push @{$self->_no_reply}, $sync;
     }
     else {
         $self->_handle->push_read( chunk => 12, $self->_read_reply );
@@ -163,6 +167,7 @@ sub _build__handle {
             $self->server->active(0);
             $self->_clear_handle();
             $self->_clear_callbacks();
+            $self->_clear_no_reply();
             $self->_debug(1, 'closing socket');
             $handle->destroy();
             $self->_try_to_send();
@@ -175,6 +180,16 @@ sub _build__handle {
             $handle->_error( Errno::ETIMEDOUT ) if keys %{$self->_callbacks};
             return;
         },
+        on_drain => sub {
+            my ($handle) = @_;
+            foreach my $sync ( @{$self->_no_reply} ) {
+                $self->_recv_finished($sync, undef, undef);
+                delete($self->_callbacks->{$sync})->(undef, undef);
+            }
+            $self->_clear_no_reply();
+            $self->_try_to_send();
+            return;
+        },
     );
 }
 
@@ -188,6 +203,11 @@ sub _build__callbacks {
     return {};
 }
 
+sub _build__no_reply {
+    my ($self) = @_;
+    return [];
+}
+
 around _choose_sync => sub {
     my ($orig, $self) = @_;
     my $sync;

-- 
Tarantool -- an efficient key/value data store

_______________________________________________
Mailing list: https://launchpad.net/~tarantool-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~tarantool-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to