arehbein has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33196 )
Change subject: stream: Fix endless loop on server on client disconnect
......................................................................
stream: Fix endless loop on server on client disconnect
Not sure why, but select() keeps reporting read events it seems,
even though the client doesn't send any packets anymore.
Without this line, the server gets stuck in an endless read loop
with zero bytes read because of that.
Change-Id: I012ddf14ae17642a52d34026d85ab6958cf488a1
---
M src/stream.c
1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/96/33196/1
diff --git a/src/stream.c b/src/stream.c
index c27e1aa..d6b16d3 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1398,6 +1398,7 @@
if (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY) {
LOGP(DLINP, LOGL_DEBUG, "Connection is being flushed and closed; ignoring received message\n");
msgb_free(msg);
+ osmo_stream_srv_destroy(conn);
return;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33196
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I012ddf14ae17642a52d34026d85ab6958cf488a1
Gerrit-Change-Number: 33196
Gerrit-PatchSet: 1
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-MessageType: newchange
arehbein has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33203 )
Change subject: stream: Move helper functions
......................................................................
stream: Move helper functions
Prepare for next commits
Change-Id: I318965538e5329c44d0910694621b5e1f1db0626
---
M src/stream.c
1 file changed, 32 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/03/33203/1
diff --git a/src/stream.c b/src/stream.c
index 35a1fc7..30639e2 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1173,6 +1173,27 @@
osmo_stream_cli_open(cli);
}
+/* msgb_l1(msg) is expected to be set */
+static inline enum ipaccess_proto msg_get_ipa_proto(struct msgb *msg)
+{
+ struct ipa_head *ih = msgb_l1(msg);
+ OSMO_ASSERT(ih);
+ return ih->proto;
+}
+
+/* msgb->l1h is expected to be set, msgb->l2h is expected to be set if
+ * we have IPAC_PROTO_OSMO specified in the header.
+ * Returns the protocol extension (enum ipaccess_proto) or -ENOPROTOOPT if
+ * we don't have IPAC_PROTO_OSMO specified in the IPA header */
+static inline int msg_get_ipa_proto_ext(struct msgb *msg)
+{
+ if (msg_get_ipa_proto(msg) != IPAC_PROTO_OSMO)
+ return -ENOPROTOOPT;
+ struct ipa_head_ext *ihe = msgb_l2(msg);
+ OSMO_ASSERT(ihe);
+ return ihe->proto;
+}
+
/*! \brief Enqueue data to be sent via an Osmocom stream client
* \param[in] cli Stream Client through which we want to send
* \param[in] msg Message buffer to enqueue in transmit queue */
@@ -1926,27 +1947,6 @@
talloc_free(conn);
}
-/* msgb_l1(msg) is expected to be set */
-static inline enum ipaccess_proto msg_get_ipa_proto(struct msgb *msg)
-{
- struct ipa_head *ih = msgb_l1(msg);
- OSMO_ASSERT(ih);
- return ih->proto;
-}
-
-/* msgb->l1h is expected to be set, msgb->l2h is expected to be set if
- * we have IPAC_PROTO_OSMO specified in the header.
- * Returns the protocol extension (enum ipaccess_proto) or -ENOPROTOOPT if
- * we don't have IPAC_PROTO_OSMO specified in the IPA header */
-static inline int msg_get_ipa_proto_ext(struct msgb *msg)
-{
- if (msg_get_ipa_proto(msg) != IPAC_PROTO_OSMO)
- return -ENOPROTOOPT;
- struct ipa_head_ext *ihe = msgb_l2(msg);
- OSMO_ASSERT(ihe);
- return ihe->proto;
-}
-
/*! \brief Enqueue IPA data to be sent via an Osmocom stream server
* \param[in] conn Stream Server through which we want to send
* \param[in] p Protocol transported by IPA. When set to IPAC_PROTO_UNSPECIFIED, the protocol will be
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33203
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I318965538e5329c44d0910694621b5e1f1db0626
Gerrit-Change-Number: 33203
Gerrit-PatchSet: 1
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-MessageType: newchange