protocol implementation

added protocol field to SQL & StatusUpdater.
This commit is contained in:
Nayef Alebrahim 2020-01-15 07:36:48 +03:00
parent 6ba4b59239
commit 31058ba18b
No known key found for this signature in database
GPG Key ID: 7F1502304671A40F
2 changed files with 3 additions and 2 deletions

View File

@ -239,6 +239,7 @@ class Installer
`server_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip` varchar(500) NOT NULL,
`port` int(5) NOT NULL,
`protocol` enum('tcp','udp') NOT NULL default 'tcp',
`request_method` varchar(50) NULL,
`label` varchar(255) NOT NULL,
`type` enum('ping','service','website') NOT NULL default 'service',

View File

@ -92,7 +92,7 @@ class StatusUpdater
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
'server_id' => $server_id,
), array(
'server_id', 'ip', 'port', 'request_method', 'label',
'server_id', 'ip', 'port', 'protocol', 'request_method', 'label',
'type', 'pattern', 'pattern_online', 'post_field',
'allow_http_status', 'redirect_check', 'header_name',
'header_value', 'status', 'active', 'warning_threshold',
@ -220,7 +220,7 @@ class StatusUpdater
// save response time
$starttime = microtime(true);
$fp = @fsockopen($this->server['ip'], $this->server['port'], $errno, $this->error, $timeout);
$fp = @fsockopen($this->server['protocol'] . '://' . $this->server['ip'], $this->server['port'], $errno, $this->error, $timeout);
$status = ($fp === false) ? false : true;
$this->rtime = (microtime(true) - $starttime);