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 */
private string $rx_buf = '';
public function __construct (\Socket $connection) {
public function __construct (\Socket $connection,bool $originate=FALSE) {
$this->connection = $connection;
if ($this->type === SOCK_STREAM) {
@ -56,7 +56,7 @@ final class SocketClient {
socket_getpeername($connection,$this->address_remote,$this->port_remote);
// 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));
if ($this->read(5,12) !== "\x0d\x0a\x0d\x0a\x00\x0d\x0aQUIT\x0a")
@ -184,7 +184,7 @@ final class SocketClient {
* @param string $address
* @param int $port
* @return static
* @throws SocketException
* @throws SocketException|HAproxyException
*/
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));
$result = FALSE;
$socket = NULL;
foreach ($resolved as $address) {
try {
@ -236,7 +237,7 @@ final class SocketClient {
if ($result === FALSE)
throw new SocketException(SocketException::CANT_CONNECT,socket_strerror(socket_last_error($socket)));
return new self($socket);
return new self($socket,TRUE);
}
/**