[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.14, Mon Nov 30 11:44:50 2009 UTC revision 1.15, Mon Nov 30 12:47:36 2009 UTC
# Line 14  Line 14 
14      no warnings qw(once);      no warnings qw(once);
15    
16      # Maximum number of requests to run per invocation.      # Maximum number of requests to run per invocation.
17      use constant MAX_REQUESTS => 5000;      use constant MAX_REQUESTS => 500;
18    
19  =head1 General Server Helper  =head1 General Server Helper
20    
# Line 33  Line 33 
33      # Turn off YAML compression, which causes problems with some of our hash keys.      # Turn off YAML compression, which causes problems with some of our hash keys.
34      $YAML::CompressSeries = 0;      $YAML::CompressSeries = 0;
35      # Create the server object.      # Create the server object.
36      Trace("Requiring $serverName") if T(3);      Trace("Requiring $serverName for task $$.") if T(3);
37      eval {      eval {
38          require "$serverName.pm";          require "$serverName.pm";
39      };      };
# Line 43  Line 43 
43      } else {      } else {
44          # Having successfully loaded the server code, we create the object.          # Having successfully loaded the server code, we create the object.
45          my $serverThing = eval("$serverName" . '->new()');          my $serverThing = eval("$serverName" . '->new()');
46            Trace("$serverName object created for task $$.") if T(2);
47          # If we have an error, create an error document.          # If we have an error, create an error document.
48          if ($@) {          if ($@) {
49              SendError($@, "Could not start server.");              SendError($@, "Could not start server.");
# Line 63  Line 64 
64                      while (($cgi = new CGI::Fast()) &&                      while (($cgi = new CGI::Fast()) &&
65                             (MAX_REQUESTS == 0 || ++$requests < MAX_REQUESTS)) {                             (MAX_REQUESTS == 0 || ++$requests < MAX_REQUESTS)) {
66                          RunRequest($cgi, $serverThing);                          RunRequest($cgi, $serverThing);
67                          MemTrace("Request $requests complete.") if T(3);                          MemTrace("Request $requests complete in task $$.") if T(3);
68                      }                      }
69                        Trace("Terminating FastCGI task $$ after $requests requests.") if T(2);
70                  } else {                  } else {
71                      # Here we have a normal web service (non-Fast).                      # Here we have a normal web service (non-Fast).
72                      my $cgi = CGI->new();                      my $cgi = CGI->new();
# Line 249  Line 251 
251      } else {      } else {
252          # The default is a function request. Get the function name.          # The default is a function request. Get the function name.
253          my $function = $cgi->param('function') || "";          my $function = $cgi->param('function') || "";
254          Trace("Server function is $function.") if T(3);          Trace("Server function for task $$ is $function.") if T(3);
255          # Insure the function name is valid.          # Insure the function name is valid.
256          Die("Invalid function name.")          Die("Invalid function name.")
257              if $function =~ /\W/;              if $function =~ /\W/;
# Line 285  Line 287 
287          }          }
288          # Stop the timer.          # Stop the timer.
289          my $duration = int(time() - $start + 0.5);          my $duration = int(time() - $start + 0.5);
290          Trace("Function executed in $duration seconds.") if T(2);          Trace("Function executed in $duration seconds by task $$.") if T(2);
291      }      }
292  }  }
293    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3