[Bio] / FigKernelPackages / ServerThing.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/ServerThing.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.65, Mon Mar 14 20:57:19 2011 UTC revision 1.72, Thu Mar 17 21:32:30 2011 UTC
# Line 66  Line 66 
66                  if ($ENV{REQUEST_METHOD} eq '') {                  if ($ENV{REQUEST_METHOD} eq '') {
67                      # Count the number of requests.                      # Count the number of requests.
68                      my $requests = 0;                      my $requests = 0;
69                      Trace("Starting Fast CGI loop.") if T(3);                      # warn "Starting fast CGI loop.\n"; ##HACK Trace("Starting Fast CGI loop.") if T(3);
70                      # Loop through the fast CGI requests. If we have request throttling,                      # Loop through the fast CGI requests. If we have request throttling,
71                      # we exit after a maximum number of requests has been exceeded.                      # we exit after a maximum number of requests has been exceeded.
72                      require CGI::Fast;                      require CGI::Fast;
73                        open(SERVER_STDERR, ">&", *STDERR);
74                      while ((MAX_REQUESTS == 0 || ++$requests < MAX_REQUESTS) &&                      while ((MAX_REQUESTS == 0 || ++$requests < MAX_REQUESTS) &&
75                             ($cgi = new CGI::Fast())) {                             ($cgi = new CGI::Fast())) {
76                            #
77                            # Remap STDERR. Inside here, our STDERR is a tie to a FCGI::Stream
78                            # so we need to save it to keep FCGI happy.
79                            #
80                            *SAVED_STDERR = *STDERR;
81                            *STDERR = *SERVER_STDERR;
82                            my $function = $cgi->param('function') || "<non-functional>"; # (useful if we do tracing in here)
83                            # warn "Function request is $function in task $$.\n"; ##HACK
84                          RunRequest($cgi, $serverThing);                          RunRequest($cgi, $serverThing);
85                          Trace("Request $requests complete in task $$.") if T(3);                          # warn "$requests requests complete in fast CGI task $$.\n"; ##HACK Trace("Request $requests complete in task $$.") if T(3);
86                            *STDERR = *SAVED_STDERR;
87                      }                      }
88                      Trace("Terminating FastCGI task $$ after $requests requests.") if T(2);                      # warn "Terminating FastCGI task $$ after $requests requests.\n"; ##HACK Trace("Terminating FastCGI task $$ after $requests requests.") if T(2);
89                        close(SERVER_STDERR);
90                  } else {                  } else {
91                      # Here we have a normal web service (non-Fast).                      # Here we have a normal web service (non-Fast).
92                      my $cgi = CGI->new();                      my $cgi = CGI->new();
# Line 524  Line 535 
535  Bit score for the match. Divide by the length of the longer PEG to get  Bit score for the match. Divide by the length of the longer PEG to get
536  what we often refer to as a "normalized bit score".  what we often refer to as a "normalized bit score".
537    
538    =item 18 (optional)
539    
540    Clear-correspondence indicator. If present, will be C<1> if the correspondence is a
541    clear bidirectional best hit (no similar candidates) and C<0> otherwise.
542    
543  =back  =back
544    
545  In the actual files, there will also be reverse correspondences indicated by a  In the actual files, there will also be reverse correspondences indicated by a
# Line 1191  Line 1207 
1207                          print $cgi->header(-type => 'text/javascript');                          print $cgi->header(-type => 'text/javascript');
1208                      }                      }
1209                      # The nature of the output depends on the encoding type.                      # The nature of the output depends on the encoding type.
1210                        eval {
1211                      my $string;                      my $string;
1212                      if ($encoding eq 'yaml') {                      if ($encoding eq 'yaml') {
1213                          $string = YAML::Dump($document);                          $string = YAML::Dump($document);
# Line 1201  Line 1218 
1218                      }                      }
1219                      print $string;                      print $string;
1220                      MemTrace(length($string) . " bytes returned from $function by task $$.") if T(Memory => 3);                      MemTrace(length($string) . " bytes returned from $function by task $$.") if T(Memory => 3);
1221                        };
1222                        if ($@) {
1223                            SendError($@, "Error encoding result.");
1224                            Trace("Error encoding result: $@") if T(0);
1225                        }
1226                  }                  }
1227              }              }
1228              # Stop the timer.              # Stop the timer.
# Line 1478  Line 1500 
1500      # Get the parameters.      # Get the parameters.
1501      my ($msg) = @_;      my ($msg) = @_;
1502      # Open the log file for appending.      # Open the log file for appending.
1503      if (open(my $oh, ">>$FIG_Config::tmp/servers.log")) {      open(my $oh, ">>$FIG_Config::temp/servers.log") || Confess("Log error: $!");
1504          print $oh "$msg\n";          print $oh "$msg\n";
1505          close $oh;          close $oh;
1506      }      }
 }  
1507    
1508  1;  1;

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.72

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3