This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13581 ) Change subject: add vty_is_active() ...................................................................... add vty_is_active() For async callbacks it is useful to determine whether a given VTY pointer is still valid. For example, in osmo-msc, a silent call can be triggered by VTY, which causes a Paging. The paging_cb then writes to the VTY console that the silent call has succeeded. Unless the telnet vty session has already ended, in which case osmo-msc crashes; e.g. from an osmo_interact_vty.py command invocation. With this function, osmo-msc can ask whether the vty pointer passed to the paging callback is still active, and skip vty_out() if not. Change-Id: I42cf2af47283dd42c101faae0fac293c3a68d599 --- M include/osmocom/vty/vty.h M src/vty/telnet_interface.c 2 files changed, 12 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Vadim Yanitskiy: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index 8d2e1b3..03a2924 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <osmocom/core/linuxlist.h> @@ -192,6 +193,7 @@ void vty_reset (void); struct vty *vty_new (void); struct vty *vty_create (int vty_sock, void *priv); +bool vty_is_active(struct vty *vty); int vty_out (struct vty *, const char *, ...) VTY_PRINTF_ATTRIBUTE(2, 3); int vty_out_va(struct vty *vty, const char *format, va_list ap); int vty_out_newline(struct vty *); diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c index dc23b12..a1fc999 100644 --- a/src/vty/telnet_interface.c +++ b/src/vty/telnet_interface.c @@ -197,6 +197,16 @@ return 0; } +bool vty_is_active(struct vty *vty) +{ + struct telnet_connection *connection; + llist_for_each_entry(connection, &active_connections, entry) { + if (connection->vty == vty) + return true; + } + return false; +} + /*! callback from core VTY code about VTY related events */ void vty_event(enum event event, int sock, struct vty *vty) { -- To view, visit https://gerrit.osmocom.org/13581 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I42cf2af47283dd42c101faae0fac293c3a68d599 Gerrit-Change-Number: 13581 Gerrit-PatchSet: 4 Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190505/c549e5ee/attachment.htm>