mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-22 18:12:49 +00:00
Config options for tick duration
This commit is contained in:
parent
cf8baca824
commit
fc8df7d5d4
@ -598,6 +598,16 @@ int64_t confValueGetInt64(const char *var, int64_t defaultValue)
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t confValueGetInt64Range(const char *var, int64_t defaultValue, int64_t rangemin, int64_t rangemax)
|
||||||
|
{
|
||||||
|
int64_t value = confValueGetInt64(var, defaultValue);
|
||||||
|
if (value >= rangemin || value <= rangemax)
|
||||||
|
return value;
|
||||||
|
WARNF("Config option %s: configured value %lld out of range [%lld,%lld], using default value %lld",
|
||||||
|
var, (long long) value, (long long) rangemin, (long long) rangemax, (long long) defaultValue);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
void confSetDebugFlags()
|
void confSetDebugFlags()
|
||||||
{
|
{
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
|
@ -260,13 +260,23 @@ int overlay_interface_init(char *name,struct sockaddr_in src_addr,struct sockadd
|
|||||||
I(bits_per_second)=speed_in_bits;
|
I(bits_per_second)=speed_in_bits;
|
||||||
I(port)=port;
|
I(port)=port;
|
||||||
I(type)=type;
|
I(type)=type;
|
||||||
I(tick_ms)=500;
|
|
||||||
I(last_tick_ms)=0;
|
I(last_tick_ms)=0;
|
||||||
I(fd)=0;
|
I(fd)=0;
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case OVERLAY_INTERFACE_PACKETRADIO: I(tick_ms)=15000; break;
|
case OVERLAY_INTERFACE_PACKETRADIO:
|
||||||
case OVERLAY_INTERFACE_ETHERNET: I(tick_ms)=500; break;
|
I(tick_ms) = confValueGetInt64Range("mdp.packetradio.tick_ms", 15000LL, 1LL, 3600000LL);
|
||||||
case OVERLAY_INTERFACE_WIFI: I(tick_ms)=500; break;
|
break;
|
||||||
|
case OVERLAY_INTERFACE_ETHERNET:
|
||||||
|
I(tick_ms) = confValueGetInt64Range("mdp.ethernet.tick_ms", 500LL, 1LL, 3600000LL);
|
||||||
|
break;
|
||||||
|
case OVERLAY_INTERFACE_WIFI:
|
||||||
|
I(tick_ms) = confValueGetInt64Range("mdp.wifi.tick_ms", 500LL, 1LL, 3600000LL);
|
||||||
|
break;
|
||||||
|
case OVERLAY_INTERFACE_UNKNOWN:
|
||||||
|
I(tick_ms) = confValueGetInt64Range("mdp.unknown.tick_ms", 500LL, 1LL, 3600000LL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return WHYF("Unsupported interface type %d", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name[0]=='>') {
|
if (name[0]=='>') {
|
||||||
|
1
serval.h
1
serval.h
@ -403,6 +403,7 @@ extern int sock;
|
|||||||
const char *confValueGet(const char *var, const char *defaultValue);
|
const char *confValueGet(const char *var, const char *defaultValue);
|
||||||
int confValueGetBoolean(const char *var, int defaultValue);
|
int confValueGetBoolean(const char *var, int defaultValue);
|
||||||
int64_t confValueGetInt64(const char *var, int64_t defaultValue);
|
int64_t confValueGetInt64(const char *var, int64_t defaultValue);
|
||||||
|
int64_t confValueGetInt64Range(const char *var, int64_t defaultValue, int64_t rangemin, int64_t rangemax);
|
||||||
void confSetDebugFlags();
|
void confSetDebugFlags();
|
||||||
int confParseBoolean(const char *text, const char *option_name);
|
int confParseBoolean(const char *text, const char *option_name);
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ setup_servald_instance() {
|
|||||||
executeOk_servald config set interfaces "+>$2"
|
executeOk_servald config set interfaces "+>$2"
|
||||||
executeOk_servald config set monitor.socket "org.servalproject.servald.monitor.socket.$TFWUNIQUE.$instance_name"
|
executeOk_servald config set monitor.socket "org.servalproject.servald.monitor.socket.$TFWUNIQUE.$instance_name"
|
||||||
executeOk_servald config set mdp.socket "org.servalproject.servald.mdp.socket.$TFWUNIQUE.$instance_name"
|
executeOk_servald config set mdp.socket "org.servalproject.servald.mdp.socket.$TFWUNIQUE.$instance_name"
|
||||||
|
executeOk_servald config set mdp.wifi.tick_ms 50
|
||||||
executeOk_servald config set mdp.selfannounce.ticks_per_full_address 1
|
executeOk_servald config set mdp.selfannounce.ticks_per_full_address 1
|
||||||
executeOk_servald keyring add
|
executeOk_servald keyring add
|
||||||
assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ]
|
assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ]
|
||||||
@ -62,7 +63,7 @@ setup_servald_instances() {
|
|||||||
setup_servald_instance +B $DUMMYNET
|
setup_servald_instance +B $DUMMYNET
|
||||||
SIDB=$sid
|
SIDB=$sid
|
||||||
# Now make sure that they can see each other
|
# Now make sure that they can see each other
|
||||||
secs=5
|
secs=1
|
||||||
sleep $secs # Should be plenty of time
|
sleep $secs # Should be plenty of time
|
||||||
echo "Dummynet file after $secs seconds: "`ls -l $DUMMYNET`
|
echo "Dummynet file after $secs seconds: "`ls -l $DUMMYNET`
|
||||||
set_instance +A
|
set_instance +A
|
||||||
|
Loading…
x
Reference in New Issue
Block a user