summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-06-17 13:53:42 -0400
committerjim-p <jimp@pfsense.org>2011-06-17 13:53:42 -0400
commitc41602e15ccb10cadb70d3295021a2208b0f4ba4 (patch)
tree49d628217e3a7d527e1675c5cf6419ed768ba3df
parent24cbe7a895c78ce12cde907ab4994630391567e0 (diff)
downloadpfsense-c41602e15ccb10cadb70d3295021a2208b0f4ba4.zip
pfsense-c41602e15ccb10cadb70d3295021a2208b0f4ba4.tar.gz
Add a GUI field to adjust the max number of processes for lighttpd.
-rw-r--r--etc/inc/system.inc11
-rw-r--r--usr/local/www/system_advanced_admin.php19
2 files changed, 26 insertions, 4 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 3f6bc3a..4857ccf 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -739,8 +739,10 @@ function system_webgui_start() {
}
/* generate lighttpd configuration */
+ $max_procs = ($config['system']['webgui']['max_procs']) ? $config['system']['webgui']['max_procs'] : 2;
system_generate_lighty_config("{$g['varetc_path']}/lighty-webConfigurator.conf",
- $crt, $key, $ca, "lighty-webConfigurator.pid", $portarg, "/usr/local/www/");
+ $crt, $key, $ca, "lighty-webConfigurator.pid", $portarg, "/usr/local/www/",
+ "cert.pem", "ca.pem", $max_procs);
/* attempt to start lighthttpd */
$res = mwexec("/usr/local/sbin/lighttpd -f {$g['varetc_path']}/lighty-webConfigurator.conf");
@@ -820,6 +822,7 @@ function system_generate_lighty_config($filename,
}
// Ramp up captive portal max procs
+ // Work relative to the default of 2, for values that would be >2.
if($captive_portal == true) {
if($avail > 65 and $avail < 98) {
$max_procs = 1;
@@ -828,13 +831,13 @@ function system_generate_lighty_config($filename,
$max_procs = 2;
}
if($avail > 127 and $avail < 256) {
- $max_procs = 3;
+ $max_procs += 1;
}
if($avail > 255 and $avail < 384) {
- $max_procs = 4;
+ $max_procs += 2;
}
if($avail > 383) {
- $max_procs = 5;
+ $max_procs += 3;
}
}
diff --git a/usr/local/www/system_advanced_admin.php b/usr/local/www/system_advanced_admin.php
index 601bb8e..4965fb9 100644
--- a/usr/local/www/system_advanced_admin.php
+++ b/usr/local/www/system_advanced_admin.php
@@ -51,6 +51,7 @@ require_once("shaper.inc");
$pconfig['webguiproto'] = $config['system']['webgui']['protocol'];
$pconfig['webguiport'] = $config['system']['webgui']['port'];
+$pconfig['max_procs'] = ($config['system']['webgui']['max_procs']) ? $config['system']['webgui']['max_procs'] : 2;
$pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref'];
$pconfig['disablehttpredirect'] = isset($config['system']['webgui']['disablehttpredirect']);
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
@@ -84,6 +85,10 @@ if ($_POST) {
if(!is_port($_POST['webguiport']))
$input_errors[] = gettext("You must specify a valid webConfigurator port number");
+ if ($_POST['max_procs'])
+ if(!is_numeric($_POST['max_procs']) || ($_POST['max_procs'] < 1) || ($_POST['max_procs'] > 500))
+ $input_errors[] = gettext("Max Processes must be a number 1 or greater");
+
if ($_POST['althostnames']) {
$althosts = explode(" ", $_POST['althostnames']);
foreach ($althosts as $ah)
@@ -111,6 +116,8 @@ if ($_POST) {
$restart_webgui = true;
if (update_if_changed("webgui certificate", $config['system']['webgui']['ssl-certref'], $_POST['ssl-certref']))
$restart_webgui = true;
+ if (update_if_changed("webgui max processes", $config['system']['webgui']['max_procs'], $_POST['max_procs']))
+ $restart_webgui = true;
if ($_POST['disablehttpredirect'] == "yes") {
$config['system']['webgui']['disablehttpredirect'] = true;
@@ -322,6 +329,18 @@ function prot_change() {
</td>
</tr>
<tr>
+ <td valign="top" class="vncell"><?=gettext("Max Processes"); ?></td>
+ <td class="vtable">
+ <input name="max_procs" type="text" class="formfld unknown" id="max_procs" "size="5" value="<?=htmlspecialchars($pconfig['max_procs']);?>">
+ <br>
+ <span class="vexpl">
+ <?=gettext("Enter the number of webConfigurator processes you " .
+ "want to run. This defaults to 2. Increasing this will allow more " .
+ "users/browsers to access the GUI concurrently."); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("WebGUI redirect"); ?></td>
<td width="78%" class="vtable">
<input name="disablehttpredirect" type="checkbox" id="disablehttpredirect" value="yes" <?php if ($pconfig['disablehttpredirect']) echo "checked"; ?> />
OpenPOWER on IntegriCloud