mirror of https://gerrit.osmocom.org/libosmocore
vty/telnet_interface: Add telnet_exit function
This frees socket and pending connections Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
aeeb7070f8
commit
dc3be0a653
|
@ -48,6 +48,8 @@ struct telnet_connection {
|
|||
|
||||
int telnet_init(void *tall_ctx, void *priv, int port);
|
||||
|
||||
void telnet_exit(void);
|
||||
|
||||
/*! }@ */
|
||||
|
||||
#endif /* TELNET_INTERFACE_H */
|
||||
|
|
|
@ -221,4 +221,16 @@ void vty_event(enum event event, int sock, struct vty *vty)
|
|||
}
|
||||
}
|
||||
|
||||
void telnet_exit(void)
|
||||
{
|
||||
struct telnet_connection *tc, *tc2;
|
||||
|
||||
llist_for_each_entry_safe(tc, tc2, &active_connections, entry)
|
||||
telnet_close_client(&tc->fd);
|
||||
|
||||
osmo_fd_unregister(&server_socket);
|
||||
close(server_socket.fd);
|
||||
talloc_free(tall_telnet_ctx);
|
||||
}
|
||||
|
||||
/*! }@ */
|
||||
|
|
Loading…
Reference in New Issue