]> dxcluster.net Git - spider.git/commitdiff
first cut at outgoing ax25 / external connects
authorminima <minima>
Wed, 14 Mar 2001 01:23:35 +0000 (01:23 +0000)
committerminima <minima>
Wed, 14 Mar 2001 01:23:35 +0000 (01:23 +0000)
Changes
perl/DXCron.pm
perl/ExtMsg.pm
perl/Msg.pm

diff --git a/Changes b/Changes
index 31774c1360e8efb23dc1f758e7de9457362f3869..5d94c2c999b4c1cc332260b47702f2593299727a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+14Mar01=======================================================================
+1. first cut at outgoing ax25 /external program connects
 13Mar01=======================================================================
 1. implemented first cut at non blocking connect
 2. removed memory leakage in connects
index 5bb1242283d635e7f11b5161a7178b62950a088a..1c698f751e5b045808c1ead66791125a848924c2 100644 (file)
@@ -217,14 +217,7 @@ sub disconnect
 {
        my $call = uc shift;
        my $dxchan = DXChannel->get($call);
-       if ($dxchan) {
-               if ($dxchan->is_ak1a) {
-                       $dxchan->send_now("D", DXProt::pc39($main::mycall, "$main::mycall DXCron"));
-               } else {
-                       $dxchan->send_now('D', "");
-               } 
-               $dxchan->disconnect;
-       }
+       $dxchan->disconnect if $dxchan;
 }
 
 # start a connect process off
@@ -255,7 +248,6 @@ sub spawn
                        # in child, unset warnings, disable debugging and general clean up from us
                        $^W = 0;
                        eval "{ package DB; sub DB {} }";
-                       alarm(0);
                        DXChannel::closeall();
                        for (@main::listeners) {
                                $_->close_server;
@@ -263,6 +255,7 @@ sub spawn
                        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 $!");
                }
index 01a30924393e088535a9d2f98f97cff11004b5b7..6ea47a516b06f69d9a43f74681cb0b8423855a04 100644 (file)
@@ -58,6 +58,9 @@ sub dequeue
        my $conn = shift;
        my $msg;
 
+       if ($conn->{sort} eq 'ax25' && exists $conn->{msg}) {
+               $conn->{msg} =~ s/\cM/\cJ/g;
+       }
        if ($conn->{state} eq 'WC') {
                if (exists $conn->{cmd}) {
                        if (@{$conn->{cmd}}) {
@@ -193,7 +196,8 @@ sub _doconnect
 {
        my ($conn, $sort, $line) = @_;
        my $r;
-       
+
+       $sort = lc $sort;
        dbg('connect', "CONNECT sort: $sort command: $line");
        if ($sort eq 'telnet') {
                # this is a straight network connect
@@ -206,7 +210,30 @@ 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 $!");
+                       }
+                       dbg('connect', "program $sort $line started");
+                       $conn->{pid} = $pid;
+                       $conn->{sort} = $sort;
+                       $conn->{lineend} = "\cM" if $sort eq 'ax25';
+               } else {
+                       dbg('connect', "can't $sort fork for $line $!");
+               }
        } else {
                dbg('err', "invalid type of connection ($sort)");
                $conn->disconnect;
index f3dec8b1610b5743e5596b7b406bd9d9ed760304..eb6892a8f1f3568f41bbda4dd3316fe78f63ee98 100644 (file)
@@ -167,8 +167,6 @@ sub disconnect {
        $call ||= 'unallocated';
        dbg('connll', "Connection $call disconnected");
        
-    set_event_handler ($sock, read => undef, write => undef, error => undef);
-
        unless ($^O =~ /^MS/i) {
                kill 'TERM', $conn->{pid} if exists $conn->{pid};
        }
@@ -181,6 +179,7 @@ sub disconnect {
        }
 
        return unless defined($sock);
+    set_event_handler ($sock, read => undef, write => undef, error => undef);
     shutdown($sock, 3);
        close($sock);
 }