diff options
author | Guillaume Mazoyer <gmazoyer@gravitons.in> | 2016-08-24 21:27:26 +0200 |
---|---|---|
committer | Guillaume Mazoyer <gmazoyer@gravitons.in> | 2016-08-24 21:27:26 +0200 |
commit | b125fa0ca129beaf819f10e7399c9878b47e905e (patch) | |
tree | e4eb5a7bb1babc6d02300f753aa3bc1265dfc0c0 /auth/telnet.php | |
parent | 027cd66297c0f56579db99d97d5fc3122ab4fe4b (diff) |
Add configuration option to change connection timeout.
The timeout can be specified in seconds with the ['timeout'] array index
within the router configuration. The default value is 30 seconds.
Diffstat (limited to 'auth/telnet.php')
-rw-r--r-- | auth/telnet.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/auth/telnet.php b/auth/telnet.php index 20b85a6..4aa7a64 100644 --- a/auth/telnet.php +++ b/auth/telnet.php @@ -37,9 +37,11 @@ final class Telnet extends Authentication { } public function connect() { - $this->connection = fsockopen($this->config['host'], $this->port); + $this->connection = fsockopen($this->config['host'], $this->port, $errno, + $errstr, $this->config['timeout']); if (!$this->connection) { - throw new Exception('Cannot connect to router.'); + throw new Exception('Cannot connect to router (code '.$errno.'['. + $errstr.']).'); } fputs($this->connection, $this->config['user']."\r\n"); |