diff options
author | Keith <keith@rhizomatica.org> | 2020-03-27 19:48:42 -0500 |
---|---|---|
committer | keith <keith@rhizomatica.org> | 2020-03-29 00:20:42 +0000 |
commit | 2c92f3c44f2e5bcfcabfe7771f17b77368d37b03 (patch) | |
tree | fab4d8b4adbff29b963770eb4921475960dc9c56 /src | |
parent | 85fe6104c55c1d46efa2036afe927f924f6f9fcd (diff) |
Meas Tools: Avoid unusable terminal in case of error on osmo_sock_init
If, as before this patch we call initCDKScreen() before
attempting to bind the socket, then the socket bind fails,
we exit and the terminal needs a reset.
Attempt to open the socket before initCDKScreen()
so we don't end up with a messed up terminal if the socket
call fails.
Change-Id: Ia5148d9ef386df314bc2837b3cb672150250bd2a
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/meas_vis.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/utils/meas_vis.c b/src/utils/meas_vis.c index aea12bf9b..e10d8148c 100644 --- a/src/utils/meas_vis.c +++ b/src/utils/meas_vis.c @@ -283,6 +283,10 @@ int main(int argc, char **argv) printf("sizeof(gsm_meas_rep)=%u\n", sizeof(struct gsm_meas_rep)); printf("sizeof(meas_feed_meas)=%u\n", sizeof(struct meas_feed_meas)); + g_st.udp_ofd.cb = udp_fd_cb; + rc = osmo_sock_init_ofd(&g_st.udp_ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 8888, OSMO_SOCK_F_BIND); + if (rc < 0) + exit(1); INIT_LLIST_HEAD(&g_st.ms_list); g_st.curses_win = initscr(); @@ -311,11 +315,6 @@ int main(int argc, char **argv) exit(0); #endif - g_st.udp_ofd.cb = udp_fd_cb; - rc = osmo_sock_init_ofd(&g_st.udp_ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 8888, OSMO_SOCK_F_BIND); - if (rc < 0) - exit(1); - while (1) { osmo_select_main(0); update_sliders(); |