00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef alarm_handler_h
00027 #define alarm_handler_h
00028
00029 #include <stdio.h>
00030
00031 #include <string>
00032
00033 #include "EventHandler.h"
00034
00042 class AlarmHandler : public EventHandler
00043 {
00044 private:
00045 FILE *d_stream;
00046 string d_version;
00047
00048
00049 AlarmHandler()
00050 {}
00051
00052 public:
00055 AlarmHandler(FILE *s) : d_stream(s)
00056 {}
00057
00058 virtual ~AlarmHandler()
00059 {
00060 fclose(d_stream);
00061 }
00062
00075 virtual void handle_signal(int signum)
00076 {
00077 if (signum != SIGALRM)
00078 fprintf(stderr, "SIGALRM handler caught another signal!\n");
00079 #if 0
00080
00081 fprintf(d_stream, "\n\n\n\n");
00082 Error e("The server has timed out. This happens when a request\n\
00083 takes longer to process than the server's preset time-out value.\n\
00084 Try making a request for a smaller amount of data. You can also contact\n\
00085 the server's administrator and request that the time-out value be increased.");
00086 e.print(d_stream);
00087 #endif
00088 exit(1);
00089 }
00090
00091 };
00092
00093 #endif