From 657fb208d6b382f36d38ad1ff1f86d9514774315 Mon Sep 17 00:00:00 2001
From: Juan Font Alonso <juanfontalonso@gmail.com>
Date: Sat, 25 Jun 2022 20:47:42 +0200
Subject: [PATCH] Flush buffered data on polling

---
 poll.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/poll.go b/poll.go
index 5549afd..394f1aa 100644
--- a/poll.go
+++ b/poll.go
@@ -323,6 +323,7 @@ func (h *Headscale) PollNetMapStream(
 
 				return
 			}
+			w.(http.Flusher).Flush()
 
 			log.Trace().
 				Str("handler", "PollNetMapStream").
@@ -390,6 +391,7 @@ func (h *Headscale) PollNetMapStream(
 
 				return
 			}
+			w.(http.Flusher).Flush()
 
 			log.Trace().
 				Str("handler", "PollNetMapStream").
@@ -478,6 +480,8 @@ func (h *Headscale) PollNetMapStream(
 
 					return
 				}
+				w.(http.Flusher).Flush()
+
 				log.Trace().
 					Str("handler", "PollNetMapStream").
 					Str("machine", machine.Hostname).