projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix simulanious connections
[spider.git]
/
perl
/
ExtMsg.pm
diff --git
a/perl/ExtMsg.pm
b/perl/ExtMsg.pm
index 33c17bfd44bcc18bef606c60a221453989da6259..cd18eb9318039974b7ae7f95101c7c9aeb534f46 100644
(file)
--- a/
perl/ExtMsg.pm
+++ b/
perl/ExtMsg.pm
@@
-29,12
+29,12
@@
sub enqueue
{
my ($conn, $msg) = @_;
unless ($msg =~ /^[ABZ]/) {
{
my ($conn, $msg) = @_;
unless ($msg =~ /^[ABZ]/) {
- if ($msg =~ /^E[-\w]+\|([01])/) {
+ if ($msg =~ /^E[-\w]+\|([01])/
&& $conn->{csort} eq 'telnet'
) {
$conn->{echo} = $1;
if ($1) {
$conn->{echo} = $1;
if ($1) {
-
$conn->send_raw("\xFF\xFC\x01");
+
#
$conn->send_raw("\xFF\xFC\x01");
} else {
} else {
-
$conn->send_raw("\xFF\xFB\x01");
+
#
$conn->send_raw("\xFF\xFB\x01");
}
} else {
$msg =~ s/^[-\w]+\|//;
}
} else {
$msg =~ s/^[-\w]+\|//;
@@
-58,7
+58,8
@@
sub dequeue
my $conn = shift;
my $msg;
my $conn = shift;
my $msg;
- while ($msg = shift @{$conn->{inqueue}}){
+ while (@{$conn->{inqueue}}){
+ $msg = shift @{$conn->{inqueue}};
dbg('connect', $msg) unless $conn->{state} eq 'C';
$msg =~ s/\xff\xfa.*\xff\xf0|\xff[\xf0-\xfe].//g; # remove telnet options
dbg('connect', $msg) unless $conn->{state} eq 'C';
$msg =~ s/\xff\xfa.*\xff\xf0|\xff[\xf0-\xfe].//g; # remove telnet options
@@
-70,9
+71,8
@@
sub dequeue
} elsif ($conn->{state} eq 'WL' ) {
$msg = uc $msg;
if (is_callsign($msg)) {
} elsif ($conn->{state} eq 'WL' ) {
$msg = uc $msg;
if (is_callsign($msg)) {
+ &{$conn->{rproc}}($conn, "A$msg|telnet");
_send_file($conn, "$main::data/connected");
_send_file($conn, "$main::data/connected");
- $conn->{call} = $msg;
- &{$conn->{rproc}}($conn, "A$conn->{call}|telnet");
$conn->{state} = 'C';
} else {
$conn->send_now("Sorry $msg is an invalid callsign");
$conn->{state} = 'C';
} else {
$conn->send_now("Sorry $msg is an invalid callsign");
@@
-91,6
+91,7
@@
sub dequeue
}
}
if ($conn->{msg} && $conn->{state} eq 'WC' && exists $conn->{cmd} && @{$conn->{cmd}}) {
}
}
if ($conn->{msg} && $conn->{state} eq 'WC' && exists $conn->{cmd} && @{$conn->{cmd}}) {
+ dbg('connect', $conn->{msg});
$conn->_docmd($conn->{msg});
if ($conn->{state} eq 'WC' && exists $conn->{cmd} && @{$conn->{cmd}} == 0) {
$conn->{state} = 'C';
$conn->_docmd($conn->{msg});
if ($conn->{state} eq 'WC' && exists $conn->{cmd} && @{$conn->{cmd}} == 0) {
$conn->{state} = 'C';
@@
-116,9
+117,9
@@
sub new_client {
$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->{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_raw("\xFF\xFC\x01");
_send_file($conn, "$main::data/issue");
_send_file($conn, "$main::data/issue");
- $conn->send_raw("
L
ogin: ");
+ $conn->send_raw("
l
ogin: ");
} else {
$conn->disconnect();
}
} else {
$conn->disconnect();
}
@@
-129,12
+130,11
@@
sub start_connect
my $call = shift;
my $fn = shift;
my $conn = ExtMsg->new(\&main::rec);
my $call = shift;
my $fn = shift;
my $conn = ExtMsg->new(\&main::rec);
- $conn->
{call} = $call
;
+ $conn->
conns($call)
;
my $f = new IO::File $fn;
push @{$conn->{cmd}}, <$f>;
$f->close;
my $f = new IO::File $fn;
push @{$conn->{cmd}}, <$f>;
$f->close;
- push @main::outstanding_connects, {call => $call, conn => $conn};
$conn->_dotimeout($deftimeout);
$conn->_docmd;
}
$conn->_dotimeout($deftimeout);
$conn->_docmd;
}
@@
-169,9
+169,6
@@
sub _docmd
}
last if $conn->{state} eq 'E';
}
}
last if $conn->{state} eq 'E';
}
- unless (exists $conn->{cmd} && @{$conn->{cmd}}) {
- @main::outstanding_connects = grep {$_->{call} ne $conn->{call}} @main::outstanding_connects;
- }
}
sub _doconnect
}
sub _doconnect
@@
-259,7
+256,6
@@
sub _timeout
my $conn = shift;
dbg('connect', "timed out after $conn->{timeval} seconds");
$conn->disconnect;
my $conn = shift;
dbg('connect', "timed out after $conn->{timeval} seconds");
$conn->disconnect;
- @main::outstanding_connects = grep {$_->{call} ne $conn->{call}} @main::outstanding_connects;
}
# handle callsign and connection type firtling
}
# handle callsign and connection type firtling
@@
-270,6
+266,10
@@
sub _doclient
my @f = split /\s+/, $line;
$conn->{call} = uc $f[0] if $f[0];
$conn->{csort} = $f[1] if $f[1];
my @f = split /\s+/, $line;
$conn->{call} = uc $f[0] if $f[0];
$conn->{csort} = $f[1] if $f[1];
+ $conn->{state} = 'C';
+ &{$conn->{rproc}}($conn, "O$conn->{call}|telnet");
+ delete $conn->{cmd};
+ $conn->{timeout}->del_timer if $conn->{timeout};
}
sub _send_file
}
sub _send_file
@@
-282,7
+282,7
@@
sub _send_file
if ($f) {
while (<$f>) {
chomp;
if ($f) {
while (<$f>) {
chomp;
- $conn->send_
later($_
);
+ $conn->send_
raw($_ . $conn->{lineend}
);
}
$f->close;
}
}
$f->close;
}