From 849d0a83e8598e0f21a3e9c5438c222d8ab417eb Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 18 Dec 2014 15:00:29 +0100 Subject: gprs: Add automatic re-connect if the GSUP connection is down Currently the GSUP connection to a server is not restarted if the connection cannot be established or is terminated during operation. This commit adds a timer based connection mechanism, basically consisting of a timer callback that calls gsup_client_connect. The timer is eventually triggered (up == 0) or cleared (up != 0) by gsup_client_updown_cb. It adds calls to osmo_timer_del() to gsup_client_connect and gprs_gsup_client_destroy. The latter is now called instead of talloc_free in gprs_gsup_client_create on error to be on the safe side. Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/gprs_gsup_client.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gprs_gsup_client.h index 89034e00a..1165c4a78 100644 --- a/openbsc/include/openbsc/gprs_gsup_client.h +++ b/openbsc/include/openbsc/gprs_gsup_client.h @@ -21,6 +21,10 @@ */ #pragma once +#include + +#define GPRS_GSUP_RECONNECT_INTERVAL 10 + struct msgb; struct ipa_client_conn; struct gprs_gsup_client; @@ -32,6 +36,9 @@ struct gprs_gsup_client { struct ipa_client_conn *link; gprs_gsup_read_cb_t read_cb; void *data; + + struct osmo_timer_list connect_timer; + int is_connected; }; struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, -- cgit v1.2.3