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]
This commit is contained in:
Jacob Erlbeck 2014-12-19 18:50:05 +01:00 committed by Holger Hans Peter Freyther
parent 849d0a83e8
commit 4188c30c4a
1 changed files with 8 additions and 0 deletions

View File

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