summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-12-19 18:50:05 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-18 17:58:56 +0100
commit4188c30c4a6574201d62df1be818eed038608d16 (patch)
tree23d2c82c20fe92a1b438df111349c2390f4c60db
parent849d0a83e8598e0f21a3e9c5438c222d8ab417eb (diff)
gprs: Avoid sending stale GSUP requests after reconnect
Currently, messages are added to the tx queue even if the connection is down for some reason and all of these messages are eventually sent after a re-connect. The MS has probably sent several Attach Requests while the connection was down and will continue doing so. Therefore these stored messages could be dropped. This patch clears the queue before re-connecting and also extends gprs_gsup_client_send to return immediately, when the connection is not established instead of calling ipa_client_conn_send. Sponsored-by: On-Waves ehf [hfreyther: Replaced while (!llist_empty(&gsupc->link->tx_queue)) llist_del(gsupc->link->tx_queue.next); with new libosmo-abis API]
-rw-r--r--openbsc/src/gprs/gprs_gsup_client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c
index 52099005c..aaf301755 100644
--- a/openbsc/src/gprs/gprs_gsup_client.c
+++ b/openbsc/src/gprs/gprs_gsup_client.c
@@ -46,6 +46,9 @@ static int gsup_client_connect(struct gprs_gsup_client *gsupc)
osmo_timer_del(&gsupc->connect_timer);
}
+ if (ipa_client_conn_clear_queue(gsupc->link) > 0)
+ LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n");
+
rc = ipa_client_conn_open(gsupc->link);
if (rc >= 0)
@@ -181,6 +184,11 @@ int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg)
return -ENOTCONN;
}
+ if (!gsupc->is_connected) {
+ msgb_free(msg);
+ return -EAGAIN;
+ }
+
ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_GSUP);
ipa_msg_push_header(msg, IPAC_PROTO_OSMO);
ipa_client_conn_send(gsupc->link, msg);