Add support for connect_timeout on both Reader and Connection constructors

Signed-off-by: Pedro Melo <melo@simplicidade.org>
This commit is contained in:
Pedro Melo
2014-07-20 17:36:31 +01:00
parent 011c7a4b82
commit bfa5a905d7
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ sub new {
$self->{host} = delete $args{host} or croak q{FATAL: required 'host' parameter is missing};
$self->{port} = delete $args{port} or croak q{FATAL: required 'port' parameter is missing};
for my $p (qw( client_id hostname connect_cb error_cb )) {
for my $p (qw( client_id hostname connect_cb error_cb connect_timeout )) {
$self->{$p} = delete $args{$p} if exists $args{$p} and defined $args{$p};
}

View File

@@ -22,7 +22,7 @@ sub new {
$self->{disconnect_cb} = delete($args{disconnect_cb}) || sub { };
$self->{error_cb} = delete($args{error_cb}) || sub { croak($_[1]) };
for my $arg (qw( ready_count client_id hostname requeue_delay )) {
for my $arg (qw( ready_count client_id hostname requeue_delay connect_timeout )) {
$self->{$arg} = delete($args{$arg}) if exists $args{$arg};
}
@@ -79,7 +79,7 @@ sub _start_nsqd_connection {
croak(qq{FATAL: could not parse '$nsqd_tcp_address' as a valid address/port combination}) unless $host and $port;
my %conn = (host => $host, port => $port);
for my $arg (qw( client_id hostname error_cb requeue_delay )) {
for my $arg (qw( client_id hostname error_cb requeue_delay connect_timeout )) {
$conn{$arg} = $self->{$arg} if exists $self->{$arg};
}