Diff for /loncom/LondTransaction.pm between versions 1.3 and 1.9

version 1.3, 2003/05/13 01:01:49 version 1.9, 2005/06/16 22:59:05
Line 35 Line 35
   
 =cut  =cut
   
   use strict;
   
 package LondTransaction;  package LondTransaction;
   
 =pod  =pod
   
 =head1 Description  =head1 Description
   
 LondTransaction objects hold the state required to manage a   LondTransaction objects hold the state required to manage a 
Line 92  Creates a new transaction object. Line 95  Creates a new transaction object.
 =cut  =cut
   
 sub new {  sub new {
     my $class       = shift;  
     my $Transaction = shift;      my ($class, $Transaction) = @_;
   
           
     my $self   = {request     => $Transaction,      my $self   = {request     => $Transaction,
   active      => 0,    active      => 0,
   deferred    => 0};    deferred    => 0};
     bless($self, $class);      bless($self, $class);
       return $self;
 }  }
   
 =pod  =pod
   
 =item Activate  =item Activate
Line 120  will be carried. Line 125  will be carried.
 =back   =back 
   
 =cut  =cut
   
 sub Activate {  sub Activate {
     my $self       = shift;  
     my $Connection = shift; # Reference to a lond connection.  
       my ($self, $Connection) = @_;
   
   
     $self->{londSocket} = $Connection; # Store the connection object and      $self->{londSocket} = $Connection; # Store the connection object and
     $self->{active}     = 1;       # Indicate it's active.      $self->{active}     = 1;       # Indicate it's active.
Line 139  transaction is deferred, the deferred fi Line 147  transaction is deferred, the deferred fi
 Otherwise this is a noop.  Otherwise this is a noop.
   
 =cut  =cut
   
 sub Retire {  sub Retire {
     my $self     = shift;      my $self     = shift;
   
Line 172  Name of the file that holds the deferred Line 181  Name of the file that holds the deferred
 =back   =back 
   
 =cut  =cut
   
 sub SetDeferred {  sub SetDeferred {
     my $self   = shift;  
     my $File   = shift;  
       my ($self, $File) = @_;
   
     $self->{deferred}      = 1;      $self->{deferred}      = 1;
     $self->{DeferrredFile} = $File;      $self->{DeferredFile} = $File;
 }  }
   
 =pod  =pod
Line 198  Parameters: Line 209  Parameters:
 =back  =back
   
 =cut  =cut
   
 sub SetClient {  sub SetClient {
     my $self   = shift;  
     my $Client = shift;      my ($self, $Client) = @_;
           
     $self->{deferred}     = 0;      $self->{deferred}     = 0;
     $self->{clientSocket} = $Client;       $self->{clientSocket} = $Client; 
Line 208  sub SetClient { Line 220  sub SetClient {
   
 =pod  =pod
   
 =item WroteSome  
   
  Called to indicate that some bytes were writtne to lond.  
  The request is trimmed by the number of bytes written.  
  If no bytes are left, nonzero is returned, else 0.  
   
 Parameters:  
   
 =over 3  
   
 =item Count  
   
 Number of bytes written  
   
 =back  
   
 =cut  
 sub WroteSome {  
     my $self   = shift;  
     my $Count  = shift;  
   
     substr($self->{request}, length($self->{request}), $Count);  
   
     return (length($self->{request]) == 0);  
   
 =pod  
   
 =head2  Selectors  =head2  Selectors
   
   
Line 243  sub WroteSome { Line 228  sub WroteSome {
 Returns the state of the deferred member.  Returns the state of the deferred member.
   
 =cut  =cut
   
 sub isDeferred {  sub isDeferred {
     my $self   = shift;      my $self   = shift;
     return $self->{deferred};      return $self->{deferred};
Line 255  sub isDeferred { Line 241  sub isDeferred {
 Returns the value of the active member.  Returns the value of the active member.
   
 =cut  =cut
   
 sub isActive {  sub isActive {
     my $self = shift;      my $self = shift;
     return $self->{active};      return $self->{active};
Line 267  sub isActive { Line 254  sub isActive {
 If not deferred returns the client socket, else returns undef.  If not deferred returns the client socket, else returns undef.
   
 =cut  =cut
   
 sub getClient {  sub getClient {
     my $self = shift;      my $self = shift;
     if($self->{deferred}) {      if($self->{deferred}) {
Line 285  If deferred, returns the name of the def Line 273  If deferred, returns the name of the def
 returns undef.  returns undef.
   
 =cut  =cut
   
 sub getFile {  sub getFile {
     my $self = shift;      my $self = shift;
     if($self->{deferred}) {      if($self->{deferred}) {
Line 302  sub getFile { Line 291  sub getFile {
   If active returns the lond server socket else undef.    If active returns the lond server socket else undef.
   
 =cut  =cut
   
 sub getServer {  sub getServer {
     my $self  = shift;      my $self  = shift;
   
Line 319  sub getServer { Line 309  sub getServer {
   Returns the remaining request text.    Returns the remaining request text.
   
 =cut  =cut
   
 sub getRequest {  sub getRequest {
     my $self = shift;      my $self = shift;
     return $self->{request};      return $self->{request};
 }  }
   
   =pod
   
   =item getLoggableRequest
   
      Use this top get what the request is when you don't want to spew
      sensitive data into logs
   
   =cut
   
   sub getLoggableRequest {
       my $self = shift;
       my ($cmd,$subcmd)=split(':',$self->{request});
       if ($cmd eq 'encrypt') {
    return "$cmd:$subcmd";
       }
       return $cmd;
   }
   
   1;

Removed from v.1.3  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>