From 69e16b9ea5dc991f8373c11b9fcf45b7b1a8e940 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Fri, 19 Dec 2014 19:00:56 +0100 Subject: 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 --- openbsc/src/gprs/gprs_gsup_client.c | 9 ++++++--- 1 file 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_) -- cgit v1.2.3