From 63053001d306ac91fe38cdaaa159687a0be623e9 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 10 Apr 2019 02:41:53 +0200 Subject: 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 --- include/osmocom/vty/vty.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/osmocom') diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index 8d2e1b36..03a29248 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -2,6 +2,7 @@ #include #include +#include #include @@ -192,6 +193,7 @@ void vty_init_vtysh (void); 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 *); -- cgit v1.2.3