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
This commit is contained in:
Jacob Erlbeck 2014-12-19 19:00:56 +01:00 committed by Holger Hans Peter Freyther
parent 4188c30c4a
commit 69e16b9ea5
1 changed files with 6 additions and 3 deletions

View File

@ -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_)