From 48639ddb983458eb20900715d8804d52424fad10 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 13 Feb 2017 23:03:36 +0100 Subject: [PATCH] fix a bug in udp hub --- transport/internet/udp/hub.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/transport/internet/udp/hub.go b/transport/internet/udp/hub.go index 628549ef..689e6898 100644 --- a/transport/internet/udp/hub.go +++ b/transport/internet/udp/hub.go @@ -130,7 +130,14 @@ func (v *Hub) WriteTo(payload []byte, dest v2net.Destination) (int, error) { func (v *Hub) start(ctx context.Context) { oobBytes := make([]byte, 256) - for range ctx.Done() { +L: + for { + select { + case <-ctx.Done(): + break L + default: + } + buffer := buf.NewSmall() var noob int var addr *net.UDPAddr