Add error reporting for APRS-IS interface failures

This commit is contained in:
XANTRONIX Development 2020-09-18 23:31:44 -05:00 committed by XANTRONIX Industrial
parent 7eca9a09c9
commit e40f2ded36

View file

@ -127,7 +127,7 @@ error_invalid:
static patty_ax25_if *create_aprs_is(struct context *ctx, static patty_ax25_if *create_aprs_is(struct context *ctx,
int argc, int argc,
char **argv) { char **argv) {
enum mode_aprs_is mode = MODE_APRS_IS_IFOPTS; patty_ax25_if *iface;
patty_ax25_aprs_is_info info = { patty_ax25_aprs_is_info info = {
.user = "N0CALL", .user = "N0CALL",
@ -137,6 +137,8 @@ static patty_ax25_if *create_aprs_is(struct context *ctx,
.filter = "m/25" .filter = "m/25"
}; };
enum mode_aprs_is mode = MODE_APRS_IS_IFOPTS;
int i; int i;
if (argc == 0) { if (argc == 0) {
@ -213,11 +215,19 @@ static patty_ax25_if *create_aprs_is(struct context *ctx,
} }
} }
return patty_ax25_if_new( ctx->name, if ((iface = patty_ax25_if_new( ctx->name,
&ctx->addr, &ctx->addr,
patty_ax25_aprs_is_driver(), patty_ax25_aprs_is_driver(),
&info); &info)) == NULL) {
patty_error_fmt(ctx->err, "Unable to connect to APRS-IS service %s:%s: %s",
info.host, info.port, strerror(errno));
goto error_if_new;
}
return iface;
error_if_new:
error_invalid: error_invalid:
return NULL; return NULL;
} }