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:
parent
8dc713ce3f
commit
f5ab36b7e5
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue