]> dxcluster.net Git - spider.git/commitdiff
change interface to connect
authorminima <minima>
Wed, 14 Mar 2001 17:00:06 +0000 (17:00 +0000)
committerminima <minima>
Wed, 14 Mar 2001 17:00:06 +0000 (17:00 +0000)
Changes
perl/ExtMsg.pm
perl/Msg.pm

diff --git a/Changes b/Changes
index 5d94c2c999b4c1cc332260b47702f2593299727a..ace7ca29c225d4aa8cc2548d9796ca547c66c734 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
 14Mar01=======================================================================
 1. first cut at outgoing ax25 /external program connects
+2. slight change of interface to connect
 13Mar01=======================================================================
 1. implemented first cut at non blocking connect
 2. removed memory leakage in connects
index 954703b335cdb0ac134b953ad6ebdd6b7c953caa..b39637d10e2af6f243eb580a6cbd814041ff24a1 100644 (file)
@@ -19,6 +19,7 @@ use DXUtil;
 use DXDebug;
 use IO::File;
 use IO::Socket;
+use IPC::Open2;
 
 use vars qw(@ISA $deftimeout);
 
@@ -210,29 +211,19 @@ sub _doconnect
                        dbg('connect', "***Connect Failed to $host $port $!");
                }
        } elsif ($sort eq 'ax25' || $sort eq 'prog') {
-               my $pid = fork();
-               if (defined $pid) {
-                       if (!$pid) {
-                               # in child, unset warnings, disable debugging and general clean up from us
-                               $^W = 0;
-                               eval "{ package DB; sub DB {} }";
-                               DXChannel::closeall();
-                               for (@main::listeners) {
-                                       $_->close_server;
-                               }
-                               unless ($^O =~ /^MS/) {
-                                       $SIG{HUP} = 'IGNORE';
-                                       $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT';
-                                       alarm(0);
-                               }
-                               exec "$line" or dbg('cron', "exec '$line' failed $!");
+               $conn->{sock} = new IO::File;
+               if ($conn->{sock}) {
+                       my $outfd = fileno($conn->{sock});
+                       my $out = new IO::File ">&$outfd";
+                       if ($conn->{pid} = open2($conn->{sock}, $out, $line)) {
+                               $conn->{csort} = $sort;
+                               $conn->{lineend} = "\cM" if $sort eq 'ax25';
+                               dbg('connect', "started $line");
+                       } else {
+                               dbg('connect', "can't start $line $!");
                        }
-                       dbg('connect', "program $sort $line started");
-                       $conn->{pid} = $pid;
-                       $conn->{csort} = $sort;
-                       $conn->{lineend} = "\cM" if $sort eq 'ax25';
                } else {
-                       dbg('connect', "can't $sort fork for $line $!");
+                       dbg('connect', "can't start $line $!");
                }
        } else {
                dbg('err', "invalid type of connection ($sort)");
index eb6892a8f1f3568f41bbda4dd3316fe78f63ee98..839b5e453313e05db16f6f536ba26d3e4b1cdd31 100644 (file)
@@ -135,7 +135,8 @@ sub connect {
        
        blocking($sock, 0);
        my $ip = gethostbyname($to_host);
-       my $r = $sock->connect($to_port, $ip);
+#      my $r = $sock->connect($to_port, $ip);
+       my $r = connect($sock, pack_sockaddr_in($to_port, $ip));
        unless ($r) {
                return undef unless $! == EINPROGRESS;
        }