diff --git a/conf_schema.h b/conf_schema.h index 93e8d043..e4e60d33 100644 --- a/conf_schema.h +++ b/conf_schema.h @@ -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") diff --git a/overlay_queue.c b/overlay_queue.c index e15f96f6..640b7ad8 100644 --- a/overlay_queue.c +++ b/overlay_queue.c @@ -64,7 +64,7 @@ int overlay_queue_init(){ int i; for(i=0;iwhence = __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); diff --git a/tests/routing b/tests/routing index ef0c81a6..17fa38ff 100755 --- a/tests/routing +++ b/tests/routing @@ -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 }