Changeset 17531

Show
Ignore:
Timestamp:
14.10.2008 18:12:20 (11 years ago)
Author:
ak19
Message:

Now works with OAIDownload.pm for downloading over OAI. The variable port (the port at which this script's serversocket is to listen) is now made global to the file because OAIDownload.pm will call the subroutine usewget several times (launching a wget several times) per instance of this WgetDownload?.pm script. This means that the port number needs to be stored for reuse as it will not be sent over and over again by GLI.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/downloaders/WgetDownload.pm

    r17529 r17531  
    8282# up before ending the child process. 
    8383my $childpid; 
    84 my($chld_out, $chld_in); 
     84my ($chld_out, $chld_in); 
    8585my ($serverSocket, $read_set); 
     86 
     87# The port this script's server socket will be listening on, to handle  
     88# incoming signals from GLI to terminate wget. This is also file global,  
     89# since OAIDownload.pm will make several calls on wget using the same  
     90# instance of this script and we want to reuse whatever port GLI gave us. 
     91my $port;  
    8692 
    8793# When this script is called from the command line, this handler will be called 
     
    202208    # Instead, when wget has to be terminated in the middle of execution, GLI will 
    203209    # connect to a serverSocket here to communicate when it's time to stop wget. 
    204     my $port; 
    205     if(defined $self->{'gli'} && $self->{'gli'}) { 
     210    if(defined $self->{'gli'} && $self->{'gli'} && !defined $port) { 
    206211 
    207212    $port = <STDIN>; # gets a port on localhost that's not yet in use 
     
    235240    }  
    236241    else { # wget finished, terminate naturally 
    237         print STDERR "\nPerl: open2 command, input stream closed. Wget terminated naturally.\n"; 
     242        #print STDERR "\nPerl: open2 command, input stream closed. Wget terminated naturally.\n"; 
    238243        close($chld_in); 
    239244        close($chld_out);