diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-12-19 19:00:56 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-18 17:59:18 +0100 |
commit | 69e16b9ea5dc991f8373c11b9fcf45b7b1a8e940 (patch) | |
tree | bfb5815cc5e6de192d0ec4eba3062b71e3308ee8 /openbsc | |
parent | 4188c30c4a6574201d62df1be818eed038608d16 (diff) |
gprs: Handle return code of ipa_client_conn_open correctly
The ipa_client_conn_open function does not distinguish between a
connection being already established or waiting for establishment.
In either case, the application gets informed about the connection
state via the updown_cb. The 'up' parameter is only set, if
poll/select consider the socket as writable.
This patch handles both cases equally and fully relies on the
updown_cb to adjust the gsupc obejct state.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/gprs/gprs_gsup_client.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index aaf301755..7bf67b7d9 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -51,8 +51,11 @@ static int gsup_client_connect(struct gprs_gsup_client *gsupc) rc = ipa_client_conn_open(gsupc->link); - if (rc >= 0) - return rc; + if (rc >= 0) { + LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", + gsupc->link->addr, gsupc->link->port); + return 0; + } LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", gsupc->link->addr, gsupc->link->port, strerror(-rc)); @@ -63,7 +66,7 @@ static int gsup_client_connect(struct gprs_gsup_client *gsupc) osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); - return 0; + return rc; } static void connect_timer_cb(void *gsupc_) |