aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/send.c')
-rw-r--r--src/send.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/send.c b/src/send.c
index 6992fd4..b9a95ac 100644
--- a/src/send.c
+++ b/src/send.c
@@ -132,16 +132,19 @@ struct packet_bundle {
static inline void send_off_bundle(struct packet_bundle *bundle, struct wireguard_peer *peer)
{
struct sk_buff *skb, *next;
- bool is_keepalive;
+ bool is_keepalive, data_sent = false;
+ if (likely(bundle->first))
+ timers_any_authenticated_packet_traversal(peer);
for (skb = bundle->first; skb; skb = next) {
/* We store the next pointer locally because socket_send_skb_to_peer
* consumes the packet before the top of the loop comes again. */
next = skb->next;
is_keepalive = skb->len == message_data_len(0);
- timers_any_authenticated_packet_traversal(peer);
if (likely(!socket_send_skb_to_peer(peer, skb, 0 /* TODO: Should we copy the DSCP value from the enclosed packet? */) && !is_keepalive))
- timers_data_sent(peer);
+ data_sent = true;
}
+ if (likely(data_sent))
+ timers_data_sent(peer);
}
static void message_create_data_done(struct sk_buff *skb, struct wireguard_peer *peer)