Fix APRS-IS connection by converting host to charlist

The host from Application.get_env returns a binary string, but :gen_tcp.connect
expects a charlist. This was causing ArgumentError on connection attempts.

Convert host to charlist if it's a binary before passing to :gen_tcp.connect.
This commit is contained in:
Graham McIntire 2025-10-25 17:23:13 -05:00
parent 8dc713ce3f
commit f5ab36b7e5
No known key found for this signature in database

View file

@ -163,6 +163,9 @@ defmodule Aprsme.AprsIsConnection do
passcode = Application.get_env(:aprsme, :aprs_is_password, "00000")
filter = Application.get_env(:aprsme, :aprs_is_default_filter, "")
# Convert host to charlist if it's a binary string
host = if is_binary(host), do: String.to_charlist(host), else: host
# Add timeout to prevent indefinite hanging
opts = [:binary, active: true, packet: :line, keepalive: true, send_timeout: 5000]
# 10 seconds