diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-12-18 15:00:29 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-18 17:24:37 +0100 |
commit | 849d0a83e8598e0f21a3e9c5438c222d8ab417eb (patch) | |
tree | bae240697759ec34811a1bcce2795c139fa6b5e4 /openbsc/include/openbsc | |
parent | 7660ffa29fb463fc24b2ac8d735b9b345017bba6 (diff) |
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
Diffstat (limited to 'openbsc/include/openbsc')
-rw-r--r-- | openbsc/include/openbsc/gprs_gsup_client.h | 7 |
1 files changed, 7 insertions, 0 deletions
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 <osmocom/core/timer.h> + +#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, |