ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/gvpe.C
(Generate patch)

Comparing gvpe/src/gvpe.C (file contents):
Revision 1.8 by pcg, Tue Apr 26 00:55:56 2005 UTC vs.
Revision 1.12 by pcg, Sat Dec 1 23:35:31 2007 UTC

48 48
49#include "conf.h" 49#include "conf.h"
50#include "slog.h" 50#include "slog.h"
51#include "util.h" 51#include "util.h"
52#include "vpn.h" 52#include "vpn.h"
53#include "iom.h" 53#include "ev_cpp.h"
54 54
55static loglevel llevel = L_NONE; 55static loglevel llevel = L_NONE;
56 56
57/* If nonzero, display usage information and exit. */ 57/* If nonzero, display usage information and exit. */
58static int show_help; 58static int show_help;
90 " -D, --no-detach Don't fork and detach.\n" 90 " -D, --no-detach Don't fork and detach.\n"
91 " -l, --log-level=LEVEL Set logging level (info, notice, warn are common).\n" 91 " -l, --log-level=LEVEL Set logging level (info, notice, warn are common).\n"
92 " -L, --mlock Lock tinc into main memory.\n" 92 " -L, --mlock Lock tinc into main memory.\n"
93 " --help Display this help and exit.\n" 93 " --help Display this help and exit.\n"
94 " --version Output version information and exit.\n\n")); 94 " --version Output version information and exit.\n\n"));
95 printf (_("Report bugs to <vpe@plan9.de>.\n")); 95 printf (_("Report bugs to <gvpe@schmorp.de>.\n"));
96 } 96 }
97 97
98 exit (status); 98 exit (status);
99} 99}
100 100
161*/ 161*/
162RETSIGTYPE 162RETSIGTYPE
163sigterm_handler (int a) 163sigterm_handler (int a)
164{ 164{
165 network.events |= vpn::EVENT_SHUTDOWN; 165 network.events |= vpn::EVENT_SHUTDOWN;
166 network.event.start (0); 166 network.event.start ();
167} 167}
168 168
169RETSIGTYPE 169RETSIGTYPE
170sighup_handler (int a) 170sighup_handler (int a)
171{ 171{
172 network.events |= vpn::EVENT_RECONNECT; 172 network.events |= vpn::EVENT_RECONNECT;
173 network.event.start (0); 173 network.event.start ();
174} 174}
175 175
176RETSIGTYPE 176RETSIGTYPE
177sigusr1_handler (int a) 177sigusr1_handler (int a)
178{ 178{
220 argc -= optind; 220 argc -= optind;
221 argv += optind; 221 argv += optind;
222 222
223 if (show_version) 223 if (show_version)
224 { 224 {
225 printf (_("%s version %s (built %s %s, protocol %d.%d)\n"), get_identity (), 225 printf (_("%s version %s (built %s %s, protocol version %d.%d)\n"), get_identity (),
226 VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); 226 VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR);
227 printf (_("Built with kernel interface %s/%s.\n"), IFTYPE, IFSUBTYPE); 227 printf (_("Built with kernel interface %s/%s.\n"), IFTYPE, IFSUBTYPE);
228 printf (_ 228 printf (_
229 ("Copyright (C) 2003 Marc Lehmann <vpe@plan9.de> and others.\n" 229 ("Copyright (C) 2003 Marc Lehmann <gvpe@schmorp.de> and others.\n"
230 "See the AUTHORS file for a complete list.\n\n" 230 "See the AUTHORS file for a complete list.\n\n"
231 "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" 231 "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
232 "and you are welcome to redistribute it under certain conditions;\n" 232 "and you are welcome to redistribute it under certain conditions;\n"
233 "see the file COPYING for details.\n")); 233 "see the file COPYING for details.\n"));
234 234
252 { 252 {
253 thisnode = *argv++; 253 thisnode = *argv++;
254 argc--; 254 argc--;
255 } 255 }
256 256
257 if (!ev_default_loop (0))
258 {
259 slog (L_ERR, _("unable to initialise the event loop (bad $LIBEV_METHODS?)"));
260 exit (EXIT_FAILURE);
261 }
262
257 { 263 {
258 configuration_parser (conf, true, argc, argv); 264 configuration_parser (conf, true, argc, argv);
259 } 265 }
260 266
261 set_loglevel (llevel != L_NONE ? llevel : conf.llevel); 267 set_loglevel (llevel != L_NONE ? llevel : conf.llevel);
274 280
275 setup_signals (); 281 setup_signals ();
276 282
277 if (!network.setup ()) 283 if (!network.setup ())
278 { 284 {
279 io_manager::loop (); 285 ev_loop (EV_DEFAULT_ 0);
280 cleanup_and_exit (EXIT_FAILURE); 286 cleanup_and_exit (EXIT_FAILURE);
281 } 287 }
282 288
283 slog (L_ERR, _("unable to setup network, unrecoverable error, exiting.")); 289 slog (L_ERR, _("unable to setup network, unrecoverable error, exiting."));
284 cleanup_and_exit (EXIT_FAILURE); 290 cleanup_and_exit (EXIT_FAILURE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines