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
diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c
index aaf3017..7bf67b7 100644
--- a/openbsc/src/gprs/gprs_gsup_client.c
+++ b/openbsc/src/gprs/gprs_gsup_client.c
@@ -51,8 +51,11 @@
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 @@
osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0);
- return 0;
+ return rc;
}
static void connect_timer_cb(void *gsupc_)