When originating a connection, ensure we dont do any HAPROXY stuff
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 37s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m52s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2024-10-19 18:34:50 +11:00
parent bf5d5bcd74
commit 3852e69fcc

View File

@ -48,7 +48,7 @@ final class SocketClient {
/** @var string Data in the RX buffer */ /** @var string Data in the RX buffer */
private string $rx_buf = ''; private string $rx_buf = '';
public function __construct (\Socket $connection) { public function __construct (\Socket $connection,bool $originate=FALSE) {
$this->connection = $connection; $this->connection = $connection;
if ($this->type === SOCK_STREAM) { if ($this->type === SOCK_STREAM) {
@ -56,7 +56,7 @@ final class SocketClient {
socket_getpeername($connection,$this->address_remote,$this->port_remote); socket_getpeername($connection,$this->address_remote,$this->port_remote);
// If HAPROXY is used, work get the clients address // If HAPROXY is used, work get the clients address
if (config('fido.haproxy')) { if ((! $originate) && config('fido.haproxy')) {
Log::debug(sprintf('%s:+ HAPROXY connection host [%s] on port [%d] (%s)',self::LOGKEY,$this->address_remote,$this->port_remote,$this->type)); Log::debug(sprintf('%s:+ HAPROXY connection host [%s] on port [%d] (%s)',self::LOGKEY,$this->address_remote,$this->port_remote,$this->type));
if ($this->read(5,12) !== "\x0d\x0a\x0d\x0a\x00\x0d\x0aQUIT\x0a") if ($this->read(5,12) !== "\x0d\x0a\x0d\x0a\x00\x0d\x0aQUIT\x0a")
@ -184,7 +184,7 @@ final class SocketClient {
* @param string $address * @param string $address
* @param int $port * @param int $port
* @return static * @return static
* @throws SocketException * @throws SocketException|HAproxyException
*/ */
public static function create(string $address,int $port): self public static function create(string $address,int $port): self
{ {
@ -207,6 +207,7 @@ final class SocketClient {
throw new SocketException(SocketException::CANT_CONNECT,sprintf('%s doesnt resolved to an IPv4/IPv6 address',$address)); throw new SocketException(SocketException::CANT_CONNECT,sprintf('%s doesnt resolved to an IPv4/IPv6 address',$address));
$result = FALSE; $result = FALSE;
$socket = NULL;
foreach ($resolved as $address) { foreach ($resolved as $address) {
try { try {
@ -236,7 +237,7 @@ final class SocketClient {
if ($result === FALSE) if ($result === FALSE)
throw new SocketException(SocketException::CANT_CONNECT,socket_strerror(socket_last_error($socket))); throw new SocketException(SocketException::CANT_CONNECT,socket_strerror(socket_last_error($socket)));
return new self($socket); return new self($socket,TRUE);
} }
/** /**