Use Unix Domain Sockets for LS internal connections.
This commit is contained in:
parent
846be13564
commit
6ecba55950
|
@ -57,19 +57,6 @@ class Liquidsoap extends AbstractBackend
|
|||
return $event->buildConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the internal port used to relay requests and other changes from AzuraCast to LiquidSoap.
|
||||
*
|
||||
* @param Entity\Station $station
|
||||
*
|
||||
* @return int The port number to use for this station.
|
||||
*/
|
||||
public function getTelnetPort(Entity\Station $station): int
|
||||
{
|
||||
$settings = $station->getBackendConfig();
|
||||
return $settings->getTelnetPort() ?? ($this->getStreamPort($station) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the port used for DJs/Streamers to connect to LiquidSoap for broadcasting.
|
||||
*
|
||||
|
@ -175,12 +162,10 @@ class Liquidsoap extends AbstractBackend
|
|||
*/
|
||||
public function command(Entity\Station $station, string $command_str): array
|
||||
{
|
||||
$uri = $this->environment->getUriToStations()
|
||||
->withScheme('tcp')
|
||||
->withPort($this->getTelnetPort($station));
|
||||
$socketPath = 'unix://' . $station->getRadioConfigDir() . '/liquidsoap.sock';
|
||||
|
||||
$fp = stream_socket_client(
|
||||
(string)$uri,
|
||||
$socketPath,
|
||||
$errno,
|
||||
$errstr,
|
||||
20
|
||||
|
|
|
@ -109,7 +109,7 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
$configDir = $station->getRadioConfigDir();
|
||||
$pidfile = $configDir . DIRECTORY_SEPARATOR . 'liquidsoap.pid';
|
||||
|
||||
$telnetPort = $this->liquidsoap->getTelnetPort($station);
|
||||
$socketFile = $configDir . DIRECTORY_SEPARATOR . 'liquidsoap.sock';
|
||||
|
||||
$stationTz = self::cleanUpString($station->getTimezone());
|
||||
|
||||
|
@ -123,9 +123,9 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
|
||||
settings.server.log.level.set(4)
|
||||
|
||||
settings.server.telnet.set(true)
|
||||
settings.server.telnet.bind_addr.set("127.0.0.1")
|
||||
settings.server.telnet.port.set(${telnetPort})
|
||||
settings.server.socket.set(true)
|
||||
settings.server.socket.permissions.set(0o660)
|
||||
settings.server.socket.path.set("${socketFile}")
|
||||
|
||||
settings.harbor.bind_addrs.set(["0.0.0.0"])
|
||||
|
||||
|
|
Loading…
Reference in New Issue