When a connection attempt via AGWPE had exhausted all retries, Direwolf
would crash (segfault) on Linux. This happened because the timer expiry
check (dl_timer_expiry) iterates over the state machine list in a way
that assumes the list is not modified during iteration. However, recent
changes to clean up AGWPE connections violated this assumption, such
that a state machine might be removed from the list during iteration.
Updating the iterations was missed in those earlier changes.
This change replaces the loop structure with one that allows for the
modification of the list during iteration. Currently t1_expiry() is
the only case in which the list may be modified; however, t3_expiry()
and tm201_expiry() loops have also been changed to insure against
possible future modifications.
Fixes#621
On startup, Direwolf states that it includes optional support for
dns-sd. However, no option is provided in the build to exclude such
support. This means that on Linux, for example, the Avahi libraries
are always required.
This change adds a CMake option to exclude DNS-SD support, for both
Linux and Mac builds. The default is to include it, retaining the
current status. To exclude it, '-DOPTIONAL_DNSSD=OFF' can be added
to the invocation of CMake.
Fixes#451
When "KISSPORT 0" is used in the config file to remove the default
port, and no other port is configured, Direwolf still announces a
KISS service on port 0. This is happening because the check for a
valid KISS port was not updated when 'kiss_port' was changed from
a single value to an array (for support of multiple KISS ports),
so the test is checking against the wrong value.
Checking against the first port in the list, per this commit, is
consistent with the use of this same value for the port number that
is announced via DNS-SD. When support is added for announcing multiple
ports, this check should be updated to check for any valid port.
Fixes#386
Per-connection data for an AGWPE connection was being cleaned up only
when the client itself went away, rather than when each connection
was terminated. This led to reuse of stale state machine instances,
which in turn led to incorrect connection attempts and statistics.
The following changes have been made to address this:
* Per-connection cleanup code from dl_client_cleanup has been moved
to a new function, dl_connection_cleanup. dl_client_cleanup now
calls this new function from within its existing loop, walking
though all connections for the client being cleaned up.
* A new function, dl_connection_terminated, encapsulates the removal
of a single state machine instance from the list and the cleanup of
that connection instance, calling dl_connection_cleanup for the
latter.
* Everywhere that server_link_terminated is being called, a new call
to dl_connection_terminated has been added nearby, to ensure the
connection is cleaned up. The call is "nearby" because invocations
of server_link_terminated differ in their surrounding calls to
other timer and state functions, and the order of those calls, so
simply wrapping server_link_terminated is not appropriate.
Many, but not all, existing calls to server_link_terminated have
nearby calls to set the state machine state to disconnected. While
this is also done in dl_connection_cleanup, the existing calls have
been left to minimize disruption. (There is no real cost associated
with changing state from disconnected to disconnected.)
These changes have been tested in as many situations as possible, with
Direwolf started using '-d ac' to watch debug output for both AGWPE
and connection / state machine related activity.
Fixes#534, Fixes#535
The home directory was only being checked for the config file if
the fopen() failed, but not if a different error occurred. Move
the home directory check outside the condition for the current
directory.
Fixes#598