ipa: Use enhanced ipa_msg_recv_buffered() to cope with partioned IPA messages
The old ipa_msg_recv() implementation didn't support partial receive,
so IPA connections got disconnected when this happened.
This patch adds the handling of the temporary message buffers and uses
ipa_msg_recv_buffered().
It has been successfully tested by jerlbeck with osmo-nitb and
osmo-bsc.
Ticket: OW#768
Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c
index 1a0f78a..a24efab 100644
--- a/openbsc/src/libbsc/bsc_msc.c
+++ b/openbsc/src/libbsc/bsc_msc.c
@@ -42,6 +42,13 @@
fd = &con->write_queue.bfd;
+ if (con->pending_msg) {
+ LOGP(DMSC, LOGL_ERROR,
+ "MSC(%s) dropping incomplete message.\n", con->name);
+ msgb_free(con->pending_msg);
+ con->pending_msg = NULL;
+ }
+
close(fd->fd);
fd->fd = -1;
fd->cb = osmo_wqueue_bfd_cb;
@@ -162,6 +169,9 @@
con->is_connected = 0;
+ msgb_free(con->pending_msg);
+ con->pending_msg = NULL;
+
fd = &con->write_queue.bfd;
fd->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
fd->priv_nr = 1;