]> dxcluster.org Git - spider.git/commitdiff
add more Mojo converted stuff
authorDirk Koopman <djk@tobit.co.uk>
Sat, 14 Sep 2013 13:08:50 +0000 (14:08 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 14 Sep 2013 13:08:50 +0000 (14:08 +0100)
perl/DXCommandmode.pm
perl/ExtMsg.pm
perl/Version.pm
perl/cluster.pl

index ad9baad05832ed2d087ee479f1d9a84a52acb519..68027807da5075edbff3dcc962e3cc3ac22aab79 100644 (file)
@@ -793,7 +793,7 @@ sub find_cmd_name {
                #we have compiled this subroutine already,
                #it has not been updated on disk, nothing left to do
                #print STDERR "already compiled $package->handler\n";
-               ;
+               dbg("find_cmd_name: $package cached") if isdbg('command');
        } else {
 
                my $sub = readfilestr($filename);
index f3f473ab7cb776b5cbd932f74e7e65edb36c5743..19aa3b47ca5e548e2d34c8c201e82934f767bc3b 100644 (file)
@@ -54,11 +54,8 @@ sub enqueue
 sub send_raw
 {
        my ($conn, $msg) = @_;
-    my $sock = $conn->{sock};
-    return unless defined($sock);
-       push (@{$conn->{outqueue}}, $msg);
-       dbg("connect $conn->{cnum}: $msg") if $conn->{state} ne 'C' && isdbg('connect');
-    Msg::set_event_handler ($sock, "write" => sub {$conn->_send(0)});
+       dbg((ref $conn) . " connect $conn->{cnum}: $msg") if $conn->{state} ne 'C' && isdbg('connect');
+       $conn->SUPER::send_raw($msg);
 }
 
 sub echo
@@ -154,57 +151,21 @@ sub to_connected
        $conn->{timeout}->del if $conn->{timeout};
        delete $conn->{timeout};
        $conn->{csort} = $sort;
-       unless ($conn->ax25) {
-               eval {$conn->{peerhost} = $conn->{sock}->peerhost};
-               $conn->nolinger;
-       }
        &{$conn->{rproc}}($conn, "$dir$call|$sort");
        $conn->_send_file("$main::data/connected") unless $conn->{outgoing};
 }
 
 sub new_client {
+       
        my $server_conn = shift;
-    my $sock = $server_conn->{sock}->accept();
-       if ($sock) {
-               my $conn = $server_conn->new($server_conn->{rproc});
-               $conn->{sock} = $sock;
-               $conn->nolinger;
-               Msg::blocking($sock, 0);
-               $conn->{blocking} = 0;
-               eval {$conn->{peerhost} = $sock->peerhost};
-               if ($@) {
-                       dbg($@) if isdbg('connll');
-                       $conn->disconnect;
-               } else {
-                       eval {$conn->{peerport} = $sock->peerport};
-                       $conn->{peerport} = 0 if $@;
-                       my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost}, $conn->{peerport});
-                       dbg("accept $conn->{cnum} from $conn->{peerhost} $conn->{peerport}") if isdbg('connll');
-                       if ($eproc) {
-                               $conn->{eproc} = $eproc;
-                               Msg::set_event_handler ($sock, "error" => $eproc);
-                       }
-                       if ($rproc) {
-                               $conn->{rproc} = $rproc;
-                               my $callback = sub {$conn->_rcv};
-                               Msg::set_event_handler ($sock, "read" => $callback);
-                               # send login prompt
-                               $conn->{state} = 'WL';
-                               #               $conn->send_raw("\xff\xfe\x01\xff\xfc\x01\ff\fd\x22");
-                               #               $conn->send_raw("\xff\xfa\x22\x01\x01\xff\xf0");
-                               #               $conn->send_raw("\xFF\xFC\x01");
-                               $conn->_send_file("$main::data/issue");
-                               $conn->send_raw("login: ");
-                               $conn->_dotimeout(60);
-                               $conn->{echo} = 1;
-                       } else { 
-                               &{$conn->{eproc}}() if $conn->{eproc};
-                               $conn->disconnect();
-                       }
-               }
-       } else {
-               dbg("ExtMsg: error on accept ($!)") if isdbg('err');
-       }
+       my $client = shift;
+       my $conn = $server_conn->SUPER::new_client($client);
+       # send login prompt
+       $conn->{state} = 'WL';
+       $conn->_send_file("$main::data/issue");
+       $conn->send_raw("login: ");
+       $conn->_dotimeout(60);
+       $conn->{echo} = 1;
 }
 
 sub start_connect
index a9a4d35d78a545c895ad243e3a9b43c39d34c9ca..27bd1c0fa38554ab80da11da15d286463fc92907 100644 (file)
@@ -12,6 +12,6 @@ use vars qw($version $subversion $build $gitversion);
 $version = '1.57';
 $subversion = '0';
 $build = '1';
-$gitversion = 'e399440';
+$gitversion = '06a6935';
 
 1;
index a3e915a614ebb45e41686a7ef7162f1d4aff6738..51d1455b41eb3b35b01cc48e793a87ea0c1d43fd 100755 (executable)
@@ -591,6 +591,8 @@ $script->run($main::me) if $script;
 
 #open(DB::OUT, "|tee /tmp/aa");
 
+my $main_loop = Mojo::IOLoop->recurring($idle_interval => \&idle_loop);
+
 Mojo::IOLoop->start;
 
 cease(0);