Show
Ignore:
Timestamp:
06/13/09 17:20:02 (6 years ago)
Author:
topia
Message:

implements randomization of connection order (aka. DNS Round-robin) for Tiarra::Socket::Connect.

see also: http://d.hatena.ne.jp/JULY/20090612/p1

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/tiarra/trunk/main/Tiarra/Socket/Connect.pm

    r11479 r33938  
    99use warnings; 
    1010use Carp; 
     11use List::Util qw(shuffle); 
    1112use Tiarra::Socket; 
    1213use base qw(Tiarra::Socket); 
     
    197198    } 
    198199 
    199     foreach my $addr (@{$entry->answer_data}) { 
     200    foreach my $addr (shuffle @{$entry->answer_data}) { 
    200201        push (@{$addrs_by_types{$this->probe_type_by_addr($addr)}}, 
    201202              $addr);