add optional INET6 capability. Need to load CPAN modules
authorDirk Koopman <djk@tobit.co.uk>
Sat, 15 Sep 2007 16:33:26 +0000 (17:33 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 15 Sep 2007 16:33:26 +0000 (17:33 +0100)
You will need IO::Socket::INET6 to use INET6 capability.
Also I have enabled PC92 slugging and set it to 1 minute as default.
Also I have put code in to handle empty first node slots in PC92.

Changes
perl/DXProtHandle.pm
perl/Msg.pm
perl/Version.pm

diff --git a/Changes b/Changes
index cda629770e61c9a1159a454384bc663e6e13a214..167d28b43ecc242414fcdcf14f8b2c97b9db4417 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+15Sep07=======================================================================
+1. Add *optional* INET6 connectivity. In order to use this you must load
+IO::Socket::INET6 and its dependencies from CPAN or get the distro's packaged
+versions. I used 'sudo aptitude install libio-socket-inet6-perl' for ubuntu
+(which should work for debian as well), for fedora/rpm based systems
+'sudo yum install perl-IO-Socket-INET6' or near equiv should work. This has
+been done quite simplistically, but it seems to work.
 10Sep07=======================================================================
 1. Remove warnings for EINPROGRESS etc for Windows perl 5.8.
 2. Try to see if using just one lastid is viable in all situations. If it is
index 1b3506150d16c7be19ddb9ddfd19f29a0fba3ab5..26eaea40003a3a51e0f194bc48158a421ff8e592 100644 (file)
@@ -51,7 +51,7 @@ $pc9x_past_age = 62*60;                       # maximum age in the past of a px9x (a config record m
                                                                # thing a node might send - once an hour)
 $pc9x_future_age = 5*60;               # maximum age in the future ditto
 $pc10_dupe_age = 45;                   # just something to catch duplicate PC10->PC93 conversions
-$pc92_slug_changes = 0;                        # slug any changes going outward for this long
+$pc92_slug_changes = 60;               # slug any changes going outward for this long
 $last_pc92_slug = 0;                   # the last time we sent out any delayed add or del PC92s
 
 # incoming talk commands
@@ -1584,7 +1584,11 @@ sub handle_92
                # this is the main route section
                # here is where all the routes are created and destroyed
 
-               my @ent = map {[ _decode_pc92_call($_) ]} grep {$_ && /^[0-7]/} @_[4 .. $#_];
+               # cope with missing duplicate node calls in the first slot for A or D
+               my $me = $_[4] || '';
+               $me ||= _encode_pc92_call($parent) if !$me && ($sort eq 'A' || $sort eq 'D');
+
+               my @ent = map {[ _decode_pc92_call($_) ]} grep {$_ && /^[0-7]/} $me, @_[5 .. $#_];
 
                if (@ent) {
 
index 00128af622318d2a601de452c5a646de5a7f465d..d4bfba36e5543a116fb095de2cb2af1c7cb879ca 100644 (file)
@@ -15,11 +15,10 @@ use strict;
 use DXUtil;
 
 use IO::Select;
-use IO::Socket;
 use DXDebug;
 use Timer;
 
-use vars qw(%rd_callbacks %wt_callbacks %er_callbacks $rd_handles $wt_handles $er_handles $now %conns $noconns $blocking_supported $cnum $total_in $total_out);
+use vars qw(%rd_callbacks %wt_callbacks %er_callbacks $rd_handles $wt_handles $er_handles $now %conns $noconns $blocking_supported $cnum $total_in $total_out $io_socket);
 
 %rd_callbacks = ();
 %wt_callbacks = ();
@@ -37,10 +36,25 @@ BEGIN {
                local $^W;
         require POSIX; POSIX->import(qw(O_NONBLOCK F_SETFL F_GETFL))
     };
+
+       eval {
+               local $^W;
+               require IO::Socket::INET6;
+       };
+
+       if ($@) {
+               dbg($@);
+               require IO::Socket;
+               $io_socket = 'IO::Socket::INET';
+       } else {
+               $io_socket = 'IO::Socket::INET6';
+       }
+       $io_socket->import;
+
        if ($@ || $main::is_win) {
-               $blocking_supported = IO::Socket->can('blocking') ? 2 : 0;
+               $blocking_supported = $io_socket->can('blocking') ? 2 : 0;
        } else {
-               $blocking_supported = IO::Socket->can('blocking') ? 2 : 1;
+               $blocking_supported = $io_socket->can('blocking') ? 2 : 1;
        }
 
 
@@ -194,7 +208,7 @@ sub connect {
        $conn->{sort} = 'Outgoing';
        
     # Create a new internet socket
-    my $sock = IO::Socket::INET->new();
+    my $sock = $io_socket->new();
     return undef unless $sock;
        
        my $proto = getprotobyname('tcp');
@@ -225,7 +239,7 @@ sub start_program
        my $pid;
        
        local $^F = 10000;              # make sure it ain't closed on exec
-       my ($a, $b) = IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
+       my ($a, $b) = $io_socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
        if ($a && $b) {
                $a->autoflush(1);
                $b->autoflush(1);
@@ -424,7 +438,7 @@ sub new_server {
     my ($pkg, $my_host, $my_port, $login_proc) = @_;
        my $self = $pkg->new($login_proc);
        
-    $self->{sock} = IO::Socket::INET->new (
+    $self->{sock} = $io_socket->new (
                                           LocalAddr => "$my_host:$my_port",
 #                                          LocalPort => $my_port,
                                           Listen    => SOMAXCONN,
index bf174eef647458626c2a8118af4580413992069a..43f4f669d9cff1ab86b7f05e2995b894135a886d 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '139';
+$build = '140';
 
 1;