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

Comparing gvpe/src/conf.C (file contents):
Revision 1.45 by pcg, Fri Aug 8 16:48:00 2008 UTC vs.
Revision 1.46 by pcg, Sun Aug 10 01:34:36 2008 UTC

92 92
93 return false; 93 return false;
94} 94}
95 95
96bool 96bool
97conf_node::can_direct (struct conf_node *other) 97conf_node::may_direct (struct conf_node *other)
98{ 98{
99 if (match_list (allow_direct, other->nodename)) 99 if (match_list (allow_direct, other->nodename))
100 return true; 100 return true;
101 101
102 if (match_list (deny_direct, other->nodename)) 102 if (match_list (deny_direct, other->nodename))
110{ 110{
111 printf ("%4d fe:fd:80:00:0%1x:%02x %c %-8.8s %-10.10s %s%s%d\n", 111 printf ("%4d fe:fd:80:00:0%1x:%02x %c %-8.8s %-10.10s %s%s%d\n",
112 id, 112 id,
113 id >> 8, id & 0xff, 113 id >> 8, id & 0xff,
114 compress ? 'Y' : 'N', 114 compress ? 'Y' : 'N',
115 connectmode == C_ONDEMAND ? "ondemand" : 115 connectmode == C_ONDEMAND ? "ondemand"
116 connectmode == C_NEVER ? "never" : 116 : connectmode == C_NEVER ? "never"
117 connectmode == C_ALWAYS ? "always" : "", 117 : connectmode == C_ALWAYS ? "always"
118 : connectmode == C_DISABLED ? "disabled"
119 : "",
118 nodename, 120 nodename,
119 hostname ? hostname : "", 121 hostname ? hostname : "",
120 hostname ? ":" : "", 122 hostname ? ":" : "",
121 hostname ? udp_port : 0 123 hostname ? udp_port : 0
122 ); 124 );
475 else if (!strcmp (var, "deny-direct")) 477 else if (!strcmp (var, "deny-direct"))
476 node->deny_direct.push_back (strdup (val)); 478 node->deny_direct.push_back (strdup (val));
477 else if (!strcmp (var, "max-ttl")) 479 else if (!strcmp (var, "max-ttl"))
478 node->max_ttl = atof (val); 480 node->max_ttl = atof (val);
479 else if (!strcmp (var, "max-queue")) 481 else if (!strcmp (var, "max-queue"))
480 {
481 node->max_queue = atoi (val); 482 node->max_queue = atoi (val);
482
483 if (node->max_queue < 1)
484 node->max_queue = 1;
485 }
486 483
487 // unknown or misplaced 484 // unknown or misplaced
488 else 485 else
489 return _("unknown configuration directive. (ignored)"); 486 return _("unknown configuration directive. (ignored)");
490 487
491 return 0; 488 return 0;
489}
490
491void conf_node::finalise ()
492{
493 if (max_queue < 1)
494 {
495 slog (L_WARN, _("%s: max-queue value invalid, setting it to 1."), nodename);
496 max_queue = 1;
497 }
498
499 if (routerprio && (connectmode != C_ALWAYS && connectmode != C_DISABLED))
500 {
501 //slog (L_WARN, _("%s: has non-zero router-priority but either 'never' or 'ondemand' as connectmode, setting it to 'always'."), nodename);
502 connectmode = C_ALWAYS;
503 }
492} 504}
493 505
494void configuration_parser::parse_argv () 506void configuration_parser::parse_argv ()
495{ 507{
496 for (int i = 0; i < argc; ++i) 508 for (int i = 0; i < argc; ++i)
601 slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); 613 slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode);
602 exit (EXIT_FAILURE); 614 exit (EXIT_FAILURE);
603 } 615 }
604 616
605 free (fname); 617 free (fname);
618
619 for (configuration::node_vector::iterator i = conf.nodes.begin(); i != conf.nodes.end(); ++i)
620 (*i)->finalise ();
606} 621}
607 622
608char *configuration::config_filename (const char *name, const char *dflt) 623char *configuration::config_filename (const char *name, const char *dflt)
609{ 624{
610 char *fname; 625 char *fname;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines