version 1.4, 2003/06/11 02:04:35
|
version 1.9, 2003/08/26 09:21:01
|
Line 37 use Crypt::IDEA;
|
Line 37 use Crypt::IDEA;
|
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
use LONCAPA::HashIterator; |
use LONCAPA::HashIterator; |
|
|
my $DebugLevel=4; |
my $DebugLevel=0; |
|
|
# Read the configuration file for apache to get the perl |
# Read the configuration file for apache to get the perl |
# variable set. |
# variable set. |
Line 145 sub new {
|
Line 145 sub new {
|
TimeoutCallback => undef, |
TimeoutCallback => undef, |
TransitionCallback => undef, |
TransitionCallback => undef, |
Timeoutable => 0, |
Timeoutable => 0, |
TimeoutValue => 60, |
TimeoutValue => 30, |
TimeoutRemaining => 0, |
TimeoutRemaining => 0, |
CipherKey => "", |
CipherKey => "", |
Cipher => undef}; |
Cipher => undef}; |
bless($self, $class); |
bless($self, $class); |
unless ($self->{Socket} = IO::Socket::INET->new(PeerHost => $self->{Host}, |
unless ($self->{Socket} = IO::Socket::INET->new(PeerHost => $self->{Host}, |
PeerPort => $self->{Port}, |
PeerPort => $self->{Port}, |
Type => SOCK_STREAM, |
Type => SOCK_STREAM, |
Proto => "tcp")) { |
Proto => "tcp", |
|
Timeout => 5)) { |
return undef; # Inidicates the socket could not be made. |
return undef; # Inidicates the socket could not be made. |
} |
} |
# |
# |
Line 161 sub new {
|
Line 162 sub new {
|
# |
# |
$self->Transition("Connected"); |
$self->Transition("Connected"); |
$self->{InformWritable} = 1; # When socket is writable we send init |
$self->{InformWritable} = 1; # When socket is writable we send init |
|
$self->{Timeoutable} = 1; # Timeout allowed during startup negotiation. |
$self->{TransactionRequest} = "init\n"; |
$self->{TransactionRequest} = "init\n"; |
|
|
# |
# |
Line 215 sub Readable {
|
Line 217 sub Readable {
|
my $rv = $socket->recv($data, POSIX::BUFSIZ, 0); |
my $rv = $socket->recv($data, POSIX::BUFSIZ, 0); |
my $errno = $! + 0; # Force numeric context. |
my $errno = $! + 0; # Force numeric context. |
|
|
unless (defined($rv) && length($data)) { # Read failed, |
unless (defined($rv) && length $data) {# Read failed, |
if(($errno == POSIX::EWOULDBLOCK) || |
if(($errno == POSIX::EWOULDBLOCK) || |
($errno == POSIX::EAGAIN) || |
($errno == POSIX::EAGAIN) || |
($errno == POSIX::EINTR) || |
($errno == POSIX::EINTR)) { |
($errno == 0)) { |
|
return 0; |
return 0; |
} |
} |
|
|
Line 488 sub SetTimeoutCallback {
|
Line 489 sub SetTimeoutCallback {
|
|
|
=pod |
=pod |
|
|
|
=head2 Shutdown: |
|
|
|
Shuts down the socket. |
|
|
|
=cut |
|
|
|
sub Shutdown { |
|
my $self = shift; |
|
my $socket = $self->GetSocket(); |
|
$socket->shutdown(2); |
|
} |
|
|
|
=pod |
|
|
=head2 GetState |
=head2 GetState |
|
|
selector for the object state. |
selector for the object state. |
Line 512 sub GetSocket {
|
Line 527 sub GetSocket {
|
return $self->{Socket}; |
return $self->{Socket}; |
} |
} |
|
|
|
|
=pod |
=pod |
|
|
=head2 WantReadable |
=head2 WantReadable |
Line 838 peer (assumes the text is a command).
|
Line 854 peer (assumes the text is a command).
|
Decrypts a block of text according to the cipher negotiated with the |
Decrypts a block of text according to the cipher negotiated with the |
peer (assumes the block was a reply. |
peer (assumes the block was a reply. |
|
|
|
=item Shutdown: |
|
|
|
Shuts off the socket. |
|
|
=head2 The following are selector member functions: |
=head2 The following are selector member functions: |
|
|
=item GetState: |
=item GetState: |