Fix binkp remote closing connection, add/delete session details, menu item this system, minor CSS fixes, move system form editing to individual files

This commit is contained in:
Deon George
2021-07-04 21:47:23 +10:00
parent d56681a187
commit acfde97e79
21 changed files with 1293 additions and 655 deletions

View File

@@ -107,6 +107,7 @@ abstract class Protocol
switch ($key) {
case 'ls_SkipGuard': /* double-skip protection on/off */
case 'rxOptions': /* Options from ZRINIT header */
case 'socket_error':
return $this->comms[$key] ?? 0;
case 'ls_rxAttnStr':
@@ -126,6 +127,7 @@ abstract class Protocol
case 'ls_rxAttnStr':
case 'ls_SkipGuard':
case 'rxOptions':
case 'socket_error':
$this->comms[$key] = $value;
break;

View File

@@ -300,8 +300,15 @@ final class SocketClient {
throw new SocketException($x=socket_last_error($this->connection),socket_strerror($x));
// If our buffer is null, see if we have any out of band data.
if (($rc == 0) && is_nulL($buf) && ($this->hasData(0) > 0))
socket_recv($this->connection,$buf, $len,MSG_OOB);
// @todo We throw an errorexception when the socket is closed by the remote I think.
if (($rc == 0) && is_nulL($buf) && ($this->hasData(0) > 0)) {
try {
socket_recv($this->connection,$buf, $len,MSG_OOB);
} catch (\Exception $e) {
throw new SocketException($x=socket_last_error($this->connection),socket_strerror($x));
}
}
return is_null($buf) ? '' : $buf;
}

View File

@@ -10,6 +10,7 @@ final class SocketException extends \Exception {
public const CANT_CONNECT = 5;
public const SOCKET_ERROR = 6;
public const SOCKET_EAGAIN = 11;
public const SOCKET_READ = 22;
private array $messages = [
self::CANT_CREATE_SOCKET => 'Can\'t create socket: "%s"',
@@ -19,6 +20,7 @@ final class SocketException extends \Exception {
self::CANT_CONNECT => 'Can\'t connect: "%s"',
self::SOCKET_ERROR => 'Socket Error: "%s"',
self::SOCKET_EAGAIN => 'Socket Resource Temporarily Unavailable - Try again',
self::SOCKET_READ => 'Unable to read from socket',
];
public function __construct(int $code,string $params=NULL) {