FreeCalypso > hg > themwi-interim
diff mtctest/main.c @ 8:a902ccbf6bbc
mtctest: introduce general user command structure
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 09 Jun 2024 02:48:55 +0000 |
parents | 33d8b3177540 |
children | 395c56969bc4 |
line wrap: on
line diff
--- a/mtctest/main.c Sun Jun 09 01:56:27 2024 +0000 +++ b/mtctest/main.c Sun Jun 09 02:48:55 2024 +0000 @@ -13,19 +13,10 @@ #include <themwi/rtp/rtp_alloc_simple.h> extern int mtc_socket; -extern int disconnect_mode; extern struct rtp_alloc_simple rtp_info; struct timeval cur_event_time; -static void -drain_stdin() -{ - char buf[256]; - - read(0, buf, sizeof buf); -} - main(argc, argv) char **argv; { @@ -64,11 +55,10 @@ max_fd = rtp_info.gsm_rtcp_fd; for (;;) { FD_ZERO(&fds); + FD_SET(0, &fds); FD_SET(mtc_socket, &fds); FD_SET(rtp_info.gsm_rtp_fd, &fds); FD_SET(rtp_info.gsm_rtcp_fd, &fds); - if (!disconnect_mode) - FD_SET(0, &fds); c = select(max_fd+1, &fds, 0, 0, 0); if (c < 0) { if (errno == EINTR) @@ -77,12 +67,10 @@ exit(1); } gettimeofday(&cur_event_time, 0); + if (FD_ISSET(0, &fds)) + select_stdin(); if (FD_ISSET(mtc_socket, &fds)) mtc_socket_select(); - if (!disconnect_mode && FD_ISSET(0, &fds)) { - drain_stdin(); - send_disconnect_req(); - } if (FD_ISSET(rtp_info.gsm_rtp_fd, &fds)) rtp_rx_select(); if (FD_ISSET(rtp_info.gsm_rtcp_fd, &fds))