bluemidget:/usr/src/liveice-sn04 # grep -C 10 "alarm" * get_local_stream.c- get_local_stream.c- get_local_stream.c-int spawn_tcp_streamer(enc_struct *e_stream) get_local_stream.c-{ get_local_stream.c- sckt *sp; get_local_stream.c- int sd; get_local_stream.c- pid_t child; get_local_stream.c- char mesg[4096]; get_local_stream.c- get_local_stream.c- if(e_stream->enabled){ get_local_stream.c: signal(SIGPIPE,alarm_timeout); get_local_stream.c- /* generate a socket*/ get_local_stream.c- sprintf(mesg,"opening connection to %s %d",e_stream->server,e_stream->port); get_local_stream.c- write_message(mesg,0); get_local_stream.c- if ((sp = sopen()) == 0) get_local_stream.c- fatal("sopen() - get remote stream - couldn't create a socket...."); get_local_stream.c- write_message("Created Socket pair",1); get_local_stream.c- get_local_stream.c- /* Make contact with server */ get_local_stream.c- write_message("Attempting to Contact Server",0); get_local_stream.c- if ((sd = sclient(sp, e_stream->server, e_stream->port)) == -1){ -- liveice.c- liveice.c-void kill_children(int signo) { liveice.c- fprintf(stderr,"Killing children...\n"); liveice.c- if(killpg(0, SIGTERM) < 0) { liveice.c- fprintf(stderr,"pid=%d pgrp=%d\n",getpid(),getpgrp()); liveice.c- perror("killpg"); liveice.c- } liveice.c- exit(0); liveice.c-} liveice.c- liveice.c:void alarm_timeout(int signo){ liveice.c: write_message("alarm timeout signal",1); liveice.c- signal (SIGALRM, SIG_IGN); liveice.c- signal (SIGPIPE, kill_children); liveice.c- g_conf.terminate_now=1; liveice.c-} liveice.c- liveice.c- liveice.c-void arm ( unsigned int secs){ liveice.c- if (secs == 0) { /* reset */ liveice.c- signal (SIGALRM, SIG_IGN); liveice.c: alarm (0); liveice.c- } else { /* set */ liveice.c: signal (SIGALRM, alarm_timeout); liveice.c: alarm (secs); liveice.c- } liveice.c-} liveice.c- liveice.c- liveice.c- liveice.c-/* Fatal error Handler */ liveice.c-void fatal(char *text) liveice.c-{ liveice.c- fix_interface(); liveice.c- close_soundcard(); -- liveice.h-/* other functions */ liveice.h-void write_message(char *msg,int pri); liveice.h-void fatal(char *text); liveice.h-int valid(unsigned long); liveice.h-float random_number(long *irand); liveice.h- liveice.h-int get_legal_rate(int rate); liveice.h- liveice.h-void encoding(void); liveice.h-void kill_children(int signo); liveice.h:void alarm_timeout(int signo); liveice.h-void arm(unsigned int secs); liveice.h-void mp3mixer(void); liveice.h- liveice.h-int write_streams(short *buf,int num); liveice.h- liveice.h-void check_soundcard(void); liveice.h-void open_soundcard(int flags); liveice.h-void close_soundcard(void); liveice.h- liveice.h-void synchronise_time(long samples); -- streams.c-} streams.c- streams.c-int spawn_tcp_streamer(enc_struct *e_stream) streams.c-{ streams.c- sckt *sp; streams.c- int sd; streams.c- pid_t child; streams.c- char mesg[4096]; streams.c- streams.c- if(e_stream->enabled){ streams.c: signal(SIGPIPE,alarm_timeout); streams.c- /* generate a socket*/ streams.c- sprintf(mesg,"opening connection to %s %d",e_stream->server,e_stream->port); streams.c- write_message(mesg,0); streams.c- if ((sp = sopen()) == 0) streams.c- fatal("sopen() - get remote stream - couldn't create a socket...."); streams.c- write_message("Created Socket pair",1); streams.c- streams.c- /* Make contact with server */ streams.c- write_message("Attempting to Contact Server",0); streams.c- if ((sd = sclient(sp, e_stream->server, e_stream->port)) == -1){