jolly has uploaded this change for review.

View Change

Do not reconnect when receiving SCTP notification

If a notification is detected by stream_sctp_recvmsg_trailer(), it
returns -EAGAIN. This is not an error that should cause the stream
client to trigger a reconnect. It must drop that message, as it is
done at the stream server.

In both cases the unhandled msg must be freed.

Change-Id: Ic588e6d8a3eecde701778f7d6ff5599ab81eff2b
---
M src/stream_cli.c
M src/stream_srv.c
2 files changed, 23 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/68/36568/1
diff --git a/src/stream_cli.c b/src/stream_cli.c
index 11c88ae..aeac78e 100644
--- a/src/stream_cli.c
+++ b/src/stream_cli.c
@@ -497,6 +497,10 @@
struct osmo_stream_cli *cli = osmo_iofd_get_data(iofd);

res = stream_iofd_sctp_recvmsg_trailer(iofd, msg, res, msgh);
+ if (res == -EAGAIN) {
+ msgb_free(msg);
+ return;
+ }

switch (cli->state) {
case STREAM_CLI_STATE_CONNECTING:
diff --git a/src/stream_srv.c b/src/stream_srv.c
index a02c1c2..994015b 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -658,8 +658,10 @@
LOGSSRV(conn, LOGL_DEBUG, "message received (res=%d)\n", res);

res = stream_iofd_sctp_recvmsg_trailer(iofd, msg, res, msgh);
- if (res == -EAGAIN)
+ if (res == -EAGAIN) {
+ msgb_free(msg);
return;
+ }

if (OSMO_UNLIKELY(res <= 0)) {
/* This connection is dead, destroy it. */

To view, visit change 36568. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ic588e6d8a3eecde701778f7d6ff5599ab81eff2b
Gerrit-Change-Number: 36568
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas@eversberg.eu>
Gerrit-MessageType: newchange