1
0
Fork 0
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

this eliminates mlathub 'connection failed' messages on container startup
This commit is contained in:
Matthias Wirth 2024-05-07 18:54:13 +02:00
parent 918b984959
commit fee8f6320b
2 changed files with 4 additions and 37 deletions

View file

@ -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

View file

@ -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: