comparison cmu200/main.c @ 86:348c29b7d02a

fc-cmu200d: ignore SIGPIPE so we don't exit if a client terminates while we are processing a command
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 16 Jul 2017 23:42:29 +0000
parents 3ec82dc1dbda
children
comparison
equal deleted inserted replaced
85:2bed7b024f64 86:348c29b7d02a
3 */ 3 */
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <signal.h>
8 9
9 int target_fd; 10 int target_fd;
10 11
11 char *bind_socket_pathname = "/tmp/fc_rftest_socket"; 12 char *bind_socket_pathname = "/tmp/fc_rftest_socket";
12 char *cmu200_tx_name = "TX"; 13 char *cmu200_tx_name = "TX";
48 open_target_serial(argv[optind], argv[optind+1]); 49 open_target_serial(argv[optind], argv[optind+1]);
49 set_serial_nonblock(0); 50 set_serial_nonblock(0);
50 setlinebuf(stdout); /* to allow logging with tee */ 51 setlinebuf(stdout); /* to allow logging with tee */
51 init_cmu200(); 52 init_cmu200();
52 create_listener_socket(); 53 create_listener_socket();
54 signal(SIGPIPE, SIG_IGN);
53 for (;;) { 55 for (;;) {
54 get_socket_connection(); 56 get_socket_connection();
55 handle_session(); 57 handle_session();
56 } 58 }
57 } 59 }