mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-11-25 15:20:10 +00:00
mlat-client: always use beast connect to send data to mlathub (#86)
- mlat-client: always use beast connect to send data to mlathub: this eliminates mlathub 'connection failed' messages on container startup - remove unused infrastructure around /run/mlathub_up
This commit is contained in:
commit
0901806175
5 changed files with 4 additions and 106 deletions
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
exec /etc/s6-overlay/scripts/mlat-client-finish
|
|
|
@ -147,10 +147,12 @@ do
|
||||||
|
|
||||||
servername=${params[0]}
|
servername=${params[0]}
|
||||||
|
|
||||||
# add return port. If none is defined, send data to the MLAT:
|
# add return port if defined
|
||||||
if [[ -n "${return_port_arg}" ]] && ! chk_disabled "${return_port_arg}"; then
|
if [[ -n "${return_port_arg}" ]] && ! chk_disabled "${return_port_arg}"; then
|
||||||
MLAT_PARAM+=("--results beast,listen,${return_port_arg}")
|
MLAT_PARAM+=("--results beast,listen,${return_port_arg}")
|
||||||
elif ! chk_disabled "${return_port_arg}"; then
|
fi
|
||||||
|
# send data to MLATHUB unless disabled
|
||||||
|
if ! chk_disabled "${return_port_arg}" && ! chk_enabled "${MLATHUB_DISABLE}"; then
|
||||||
MLAT_PARAM+=("--results beast,connect,localhost:${MLATHUB_BEAST_IN_PORT:-31004}")
|
MLAT_PARAM+=("--results beast,connect,localhost:${MLATHUB_BEAST_IN_PORT:-31004}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -230,10 +232,6 @@ done
|
||||||
|
|
||||||
sleep 5 & wait $!
|
sleep 5 & wait $!
|
||||||
|
|
||||||
# All MLAT Clients are up, so set the flag. This flag is read by MLATHUB as a sign that it's
|
|
||||||
# safe to start up
|
|
||||||
touch /run/mlathub_up
|
|
||||||
|
|
||||||
# Now iterate over all MLAT-client instances and check if they are still running:
|
# Now iterate over all MLAT-client instances and check if they are still running:
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/command/with-contenv bash
|
|
||||||
#shellcheck shell=bash disable=SC2015,SC1091
|
|
||||||
|
|
||||||
source /scripts/common
|
|
||||||
|
|
||||||
# Remove MLATHub Up
|
|
||||||
#---------------------------------------------------------------------------------------------
|
|
||||||
# Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by the
|
|
||||||
# Free Software Foundation, either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
rm -f /run/mlathub_up
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -51,41 +51,6 @@ MLATHUB_CMD+=("--net-bi-port=${MLATHUB_BEAST_IN_PORT:-31004}")
|
||||||
MLATHUB_CMD+=("--net-bo-port=${MLATHUB_BEAST_OUT_PORT:-31005}")
|
MLATHUB_CMD+=("--net-bo-port=${MLATHUB_BEAST_OUT_PORT:-31005}")
|
||||||
MLATHUB_CMD+=("--net-beast-reduce-out-port=${MLATHUB_BEAST_REDUCE_OUT_PORT:-31006}")
|
MLATHUB_CMD+=("--net-beast-reduce-out-port=${MLATHUB_BEAST_REDUCE_OUT_PORT:-31006}")
|
||||||
|
|
||||||
# We need to get the mlat results ports from the parameters:
|
|
||||||
# parse MLAT_CONFIG string into mlat_configs array
|
|
||||||
# Strip any extraneous spaces:
|
|
||||||
MLAT_CONFIG="${MLAT_CONFIG#"${MLAT_CONFIG%%[![:space:]]*}"}" # strip leading space
|
|
||||||
MLAT_CONFIG="${MLAT_CONFIG//; /;}"
|
|
||||||
# remove any newlines:
|
|
||||||
MLAT_CONFIG="${MLAT_CONFIG//$'\n'/}"
|
|
||||||
readarray -td ";" mlat_configs < <(printf '%s' "${MLAT_CONFIG// /}")
|
|
||||||
# Now loop through the MLAT_CONFIG items and add a net-connector for each of them:
|
|
||||||
mlat_result_sources=0
|
|
||||||
for instance in "${mlat_configs[@]}"
|
|
||||||
do
|
|
||||||
# shellcheck disable=SC2015
|
|
||||||
[[ -z "${instance}" ]] && continue || true
|
|
||||||
# put individual params into the $params array:
|
|
||||||
readarray -td "," params < <(printf '%s' "${instance}")
|
|
||||||
|
|
||||||
for ((i=2; i<${#params[*]}; i++))
|
|
||||||
do
|
|
||||||
if [[ -n "${params[i]}" ]] && [[ "${params[i]}" =~ ^[0-9]+$ ]]; then
|
|
||||||
# the parameter is a number and it is assumed that this is the beast_results port
|
|
||||||
MLATHUB_CMD+=("--net-connector=localhost,${params[i]},beast_in")
|
|
||||||
(( mlat_result_sources++ )) || true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
# the following is no longer reliable as mlat sources can be external
|
|
||||||
#if (( mlat_result_sources == 0 ))
|
|
||||||
#then
|
|
||||||
# "${s6wrap[@]}" --args echo "No MLAT servers have been defined in MLAT_CONFIG - no need to start MLATHUB"
|
|
||||||
# exec sleep infinity
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# Add any additional net_connectors:
|
# Add any additional net_connectors:
|
||||||
if [[ -n "$MLATHUB_NET_CONNECTOR" ]]; then
|
if [[ -n "$MLATHUB_NET_CONNECTOR" ]]; then
|
||||||
# Strip any extraneous spaces:
|
# Strip any extraneous spaces:
|
||||||
|
@ -130,19 +95,6 @@ fi
|
||||||
# Handle "--net-heartbeat=<rate>"
|
# Handle "--net-heartbeat=<rate>"
|
||||||
MLATHUB_CMD+=("--net-heartbeat=${READSB_NET_HEARTBEAT:-35}")
|
MLATHUB_CMD+=("--net-heartbeat=${READSB_NET_HEARTBEAT:-35}")
|
||||||
|
|
||||||
# No longer any need to wait, we can start up immediate
|
|
||||||
#if [[ ! -f /run/mlathub_up ]]
|
|
||||||
#then
|
|
||||||
# if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then
|
|
||||||
# "${s6wrap[@]}" --args echo "Delaying MLAT hub start until container is established..."
|
|
||||||
# fi
|
|
||||||
# while [[ ! -f /run/mlathub_up ]]
|
|
||||||
# do
|
|
||||||
# sleep 2
|
|
||||||
# done
|
|
||||||
#fi
|
|
||||||
#sleep 5 # sleep a bit so everything is well established
|
|
||||||
|
|
||||||
"${s6wrap[@]}" --args echo "Starting MLATHUB..."
|
"${s6wrap[@]}" --args echo "Starting MLATHUB..."
|
||||||
|
|
||||||
# shellcheck disable=SC2086,SC2069
|
# shellcheck disable=SC2086,SC2069
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/command/with-contenv bash
|
|
||||||
#shellcheck shell=bash disable=SC2015,SC1091
|
|
||||||
|
|
||||||
source /scripts/common
|
|
||||||
|
|
||||||
# MLATHub Prep
|
|
||||||
#---------------------------------------------------------------------------------------------
|
|
||||||
# Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by the
|
|
||||||
# Free Software Foundation, either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
rm -f /run/mlathub_up
|
|
||||||
|
|
||||||
exit 0
|
|
Loading…
Reference in a new issue