pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31808 )
Change subject: select: Optimize osmo_fd_get_by_fd
......................................................................
Patch Set 1:
(1 comment)
File src/core/select.c:
https://gerrit.osmocom.org/c/libosmocore/+/31808/comment/8e55334e_1c54d17e
PS1, Line 223: if (fd->fd >= 0)
> Here I'd like to have an OSMO_ASSERT(fd->fd >=0) instead, but that made one unit test in osmo-mgw hi […]
BTW, the fact that we assert there would also probably mean we can optimize osmo_fd_is_registered() to be O(k) instead of O(n), because we can guarantee that the pointer in the table won't leak and will be NULL when the fd is unregistered.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31808
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8b71547df8bed84192cb160479fa3debf9b7eade
Gerrit-Change-Number: 31808
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Thu, 09 Mar 2023 17:51:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31808 )
Change subject: select: Optimize osmo_fd_get_by_fd
......................................................................
Patch Set 1:
(1 comment)
File src/core/select.c:
https://gerrit.osmocom.org/c/libosmocore/+/31808/comment/cd9f53ae_52bfc27f
PS1, Line 223: if (fd->fd >= 0)
Here I'd like to have an OSMO_ASSERT(fd->fd >=0) instead, but that made one unit test in osmo-mgw hit the assert: https://gerrit.osmocom.org/c/osmo-mgw/+/31806
Other projects are running fine so far (A previous patch for libosmocore also fixes one related issue heating this assert).
Even if that makes older osmo-mgw assert, I think it is still acceptable because it is actually detecting a bug in osmo-mgw.
Users of the osmo_fd API shouldn't change the fd value while the osmo_fd is registered, that's calling for a potential mess.
This actually even causes bugs inside libosmocore before this patch, see call to osmo_stats_tcp_osmo_fd_unregister(fd) just below, which will probably leak due to not finding the fd because it has been set to -1 prior to unregistering.
So, do others agree I should use an OSMO_ASSERT there? this will help in finding bugs during development time by hitting the assert, rather than ending up with fucked up silently at production time.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31808
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8b71547df8bed84192cb160479fa3debf9b7eade
Gerrit-Change-Number: 31808
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Thu, 09 Mar 2023 17:50:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/31807 )
Change subject: cosmetic: stats_tcp: Fix typo in comment
......................................................................
cosmetic: stats_tcp: Fix typo in comment
Take the chance to shorten a bit the lengthy lines
Change-Id: I3215dea7e3198b728745a779ad1b6ebfa3795cb5
---
M src/core/stats_tcp.c
1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/07/31807/1
diff --git a/src/core/stats_tcp.c b/src/core/stats_tcp.c
index ebb380e..c6459fe 100644
--- a/src/core/stats_tcp.c
+++ b/src/core/stats_tcp.c
@@ -247,8 +247,10 @@
pthread_mutex_lock(&stats_tcp_lock);
llist_for_each_entry(stats_tcp_entry, &stats_tcp, entry) {
if (fd->fd == stats_tcp_entry->fd->fd) {
- /* In case we want to remove exactly that item which is also selected as the current itemy, we
- * must designate either a different item or invalidate the current item. */
+ /* In case we want to remove exactly that item which is also
+ * selected as the current item, we must designate either a
+ * different item or invalidate the current item.
+ */
if (stats_tcp_entry == stats_tcp_entry_cur) {
if (llist_count(&stats_tcp) > 2)
next_stats_tcp_entry();
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31807
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3215dea7e3198b728745a779ad1b6ebfa3795cb5
Gerrit-Change-Number: 31807
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31805 )
Change subject: gsmtap.h: Define a packet type for encapsulation of GSM RLP frames
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31805
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibb7f0731c31e5a5cd2911f733da5510ce0f3a1d6
Gerrit-Change-Number: 31805
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Thu, 09 Mar 2023 17:35:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment