Skip to content
Snippets Groups Projects
Commit e9b077e6 authored by Yuriy Nevinitsin's avatar Yuriy Nevinitsin
Browse files

[connector][perl] fix

parent 714757f6
No related branches found
No related tags found
No related merge requests found
...@@ -232,13 +232,13 @@ sub send { ...@@ -232,13 +232,13 @@ sub send {
local $SIG{__DIE__} = sub { local $! = 0; $olddie->(@_); } if $olddie; local $SIG{__DIE__} = sub { local $! = 0; $olddie->(@_); } if $olddie;
my %servers; my %servers;
my ($data, $error, $errno); my ($data, $error, $errno);
my $fh = $self->_send_now($message, sub { my $conn = $self->_send_now($message, sub {
($data, $error) = @_; ($data, $error) = @_;
$errno = $!; $errno = $!;
return; return;
}, \%servers); }, \%servers);
return if $message->{continue} && !$fh; return if $message->{continue} && !$conn;
my $cont = sub { my $cont = sub {
$self->_recv_now(\%servers, max => $message->{continue}?1:0); $self->_recv_now(\%servers, max => $message->{continue}?1:0);
...@@ -249,8 +249,9 @@ sub send { ...@@ -249,8 +249,9 @@ sub send {
}; };
return { return {
fh => $fh, fh => $conn->fh,
continue => $cont, connection => $conn,
continue => $cont,
} if $message->{continue}; } if $message->{continue};
return &$cont(); return &$cont();
...@@ -553,7 +554,7 @@ sub _send_try { ...@@ -553,7 +554,7 @@ sub _send_try {
my $connection = $server->$xsync(); my $connection = $server->$xsync();
return unless $connection->send($args->{msg}, $args->{body}, $handler, $args->{no_reply}, $args->{sync}); return unless $connection->send($args->{msg}, $args->{body}, $handler, $args->{no_reply}, $args->{sync});
$sync->{$connection} ||= $connection if $sync; $sync->{$connection} ||= $connection if $sync;
return $connection->fh; return $connection;
} }
sub _send_retry { sub _send_retry {
......
...@@ -269,6 +269,8 @@ around _choose_sync => sub { ...@@ -269,6 +269,8 @@ around _choose_sync => sub {
die "Can't choose sync value after 50 iterations"; die "Can't choose sync value after 50 iterations";
}; };
sub Close { die "This is not what should be done" }
=back =back
=head1 SEE ALSO =head1 SEE ALSO
......
...@@ -45,6 +45,15 @@ See L<MR::IProto::Connection/send> for more information. ...@@ -45,6 +45,15 @@ See L<MR::IProto::Connection/send> for more information.
sub fh { return $_[0]->_has_socket && $_[0]->_socket } sub fh { return $_[0]->_has_socket && $_[0]->_socket }
sub Close {
my ($self, $reason) = @_;
my $sent = $self->_sent;
while (my $args = shift @$sent) {
my ($sync, $callback) = @$args;
$self->_handle_error($sync, $callback, $reason);
}
}
sub send { sub send {
my ($self, $msg, $payload, $callback, $no_reply, $sync) = @_; my ($self, $msg, $payload, $callback, $no_reply, $sync) = @_;
my $server = $self->server; my $server = $self->server;
......
...@@ -79,7 +79,7 @@ use constant { ...@@ -79,7 +79,7 @@ use constant {
sub IPROTOCLASS () { 'MR::IProto' } sub IPROTOCLASS () { 'MR::IProto' }
use vars qw/$VERSION %ERRORS/; use vars qw/$VERSION %ERRORS/;
$VERSION = 0.0.15; $VERSION = 0.0.16;
BEGIN { *confess = \&MR::IProto::confess } BEGIN { *confess = \&MR::IProto::confess }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment