Add transmit timeout config per network destination for low bandwidth links

This commit is contained in:
Jeremy Lakeman 2015-03-30 14:15:08 +10:30
parent e680ccb0ec
commit 943bca3bea
3 changed files with 13 additions and 13 deletions

@ -331,6 +331,7 @@ ATOM(int32_t, mtu, 1200, int32_nonneg,, "Maximum trans
ATOM(int32_t, tick_ms, -1, int32_nonneg,, "Keep alive interval")
ATOM(int32_t, packet_interval, -1, int32_nonneg,, "Minimum interval between packets in microseconds")
ATOM(int32_t, reachable_timeout_ms, -1, int32_nonneg,, "Inactivity timeout after which node considered unreachable")
ATOM(int32_t, transmit_timeout_ms, 1000, int32_nonneg,, "Maximum duration to hold a packet before transmission")
ATOM(bool_t, drop, 0, boolean,, "If true, drop all incoming packets")
ATOM(bool_t, send, 1, boolean,, "If false, don't send any packets")
ATOM(bool_t, route, 1, boolean,, "If false, do not advertise any links")

@ -64,7 +64,7 @@ int overlay_queue_init(){
int i;
for(i=0;i<OQ_MAX;i++) {
overlay_tx[i].maxLength=100;
overlay_tx[i].latencyTarget=1000; /* Keep packets in queue for 1 second by default */
overlay_tx[i].latencyTarget=0; // no QOS time limit by default
overlay_tx[i].small_packet_grace_interval = 5;
}
/* expire voice/video call packets much sooner, as they just aren't any use if late */
@ -73,7 +73,7 @@ int overlay_queue_init(){
overlay_tx[OQ_ISOCHRONOUS_VIDEO].latencyTarget=200;
overlay_tx[OQ_OPPORTUNISTIC].small_packet_grace_interval = 20;
overlay_tx[OQ_OPPORTUNISTIC].small_packet_grace_interval = 100;
return 0;
}
@ -159,10 +159,6 @@ int _overlay_payload_enqueue(struct __sourceloc __whence, struct overlay_frame *
p->whence = __whence;
overlay_txqueue *queue = &overlay_tx[p->queue];
if (config.debug.packettx)
DEBUGF("Enqueuing packet for %s* (q[%d].length = %d)",
p->destination?alloca_tohex_sid_t_trunc(p->destination->sid, 14): alloca_tohex(p->broadcast_id.id, BROADCAST_LEN),
p->queue, queue->length);
if (ob_overrun(p->payload))
return WHY("Packet content overrun -- not queueing");
@ -351,7 +347,7 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
// TODO stop when the packet is nearly full?
while(frame){
if (frame->enqueued_at + queue->latencyTarget < now){
if (queue->latencyTarget!=0 && frame->enqueued_at + queue->latencyTarget < now){
if (config.debug.overlayframes)
DEBUGF("Dropping frame type %x (length %zu) for %s due to expiry timeout",
frame->type, frame->payload->checkpointLength,
@ -403,6 +399,10 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
frame_remove_destination(frame, i);
continue;
}
if (frame->enqueued_at + dest->ifconfig.transmit_timeout_ms < now){
frame_remove_destination(frame, i);
continue;
}
if (ob_position(frame->payload) > (unsigned)dest->ifconfig.mtu){
WARNF("Skipping packet destination as size %zu > destination mtu %zd",
ob_position(frame->payload), dest->ifconfig.mtu);

@ -320,24 +320,23 @@ teardown_simulate_extender() {
tfw_cat "$SERVALD_VAR/radioerr"
}
doc_lowband_broadcast="Link detection over very low bandwith links"
doc_lowband_broadcast="Link detection over low bandwith links"
setup_lowband_broadcast() {
setup_servald
foreach_instance +A +B create_single_identity
foreach_instance +A +B add_servald_interface 1
foreach_instance +A +B executeOk_servald config \
set interfaces.1.broadcast.packet_interval 10000000 \
set interfaces.1.broadcast.packet_interval 2000000 \
set interfaces.1.broadcast.transmit_timeout_ms 6200 \
set interfaces.1.broadcast.tick_ms 15000 \
set interfaces.1.broadcast.mtu 180 \
set interfaces.1.broadcast.mtu 210 \
set interfaces.1.broadcast.route off \
set interfaces.1.unicast.send off
foreach_instance +A +B start_servald_server
}
test_lowband_broadcast() {
#wait_until path_exists +A +B
#wait_until path_exists +B +A
set_instance +A
executeOk_servald mdp ping --interval=5 --timeout=30 $SIDB 5
executeOk_servald mdp ping --interval=3 --timeout=6 $SIDB 3
tfw_cat --stdout --stderr
}