[LON-CAPA-cvs] cvs: loncom / LondConnection.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Mon, 15 Sep 2003 09:25:57 -0000
foxr Mon Sep 15 05:25:57 2003 EDT
Modified files:
/loncom LondConnection.pm
Log:
Correctly catch the refused string from peers that don't want to talk with us.
Honestly it was there initially.. just left the \n off the target of the comparison.
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.9 loncom/LondConnection.pm:1.10
--- loncom/LondConnection.pm:1.9 Tue Aug 26 05:21:01 2003
+++ loncom/LondConnection.pm Mon Sep 15 05:25:57 2003
@@ -1,7 +1,7 @@
# This module defines and implements a class that represents
# a connection to a lond daemon.
#
-# $Id: LondConnection.pm,v 1.9 2003/08/26 09:21:01 foxr Exp $
+# $Id: LondConnection.pm,v 1.10 2003/09/15 09:25:57 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,6 +27,7 @@
#
package LondConnection;
+use strict;
use IO::Socket;
use IO::Socket::INET;
use IO::Handle;
@@ -70,6 +71,8 @@
sub Dump {
my $self = shift;
+ my $key;
+ my $value;
print "Dumping LondConnectionObject:\n";
while(($key, $value) = each %$self) {
print "$key -> $value\n";
@@ -169,7 +172,7 @@
# Set socket to nonblocking I/O.
#
my $socket = $self->{Socket};
- $flags = fcntl($socket->fileno, F_GETFL,0);
+ my $flags = fcntl($socket->fileno, F_GETFL,0);
if($flags == -1) {
$socket->close;
return undef;
@@ -238,7 +241,7 @@
if($self->{TransactionReply} =~ /(.*\n)/) {
&Debug(8,"Readable End of line detected");
if ($self->{State} eq "Initialized") { # We received the challenge:
- if($self->{TransactionReply} eq "refused") { # Remote doesn't have
+ if($self->{TransactionReply} eq "refused\n") { # Remote doesn't have
$self->Transition("Disconnected"); # in host tables.
$socket->close();
@@ -338,7 +341,7 @@
}
}
- if (($rv >= 0) ||
+ if (($nwritten >= 0) ||
($errno == POSIX::EWOULDBLOCK) ||
($errno == POSIX::EAGAIN) ||
($errno == POSIX::EINTR) ||
@@ -655,7 +658,7 @@
# Decode the data in 8 byte blocks. The string is encoded
# as hex digits so there are two characters per byte:
- $decrpyted = "";
+ my $decrypted = "";
for(my $index = 0; $index < length($EncryptedString);
$index += 16) {
$decrypted .= $self->{Cipher}->decrypt(