From: Bruno Clermont Date: Wed, 8 Feb 2017 11:17:42 +0000 (+0800) Subject: turn `udpBufs` as a local variable instead of global X-Git-Url: http://www.git.cypherpunks.ru/?a=commitdiff_plain;h=6c58796f178492c4b06d68af774a75a6ee5a516f;p=govpn.git turn `udpBufs` as a local variable instead of global --- diff --git a/src/cypherpunks.ru/govpn/server/udp.go b/src/cypherpunks.ru/govpn/server/udp.go index c579301..32fde7d 100644 --- a/src/cypherpunks.ru/govpn/server/udp.go +++ b/src/cypherpunks.ru/govpn/server/udp.go @@ -36,10 +36,6 @@ func (c udpSender) Write(data []byte) (int, error) { return c.conn.WriteToUDP(data, c.addr) } -// TODO move to udpSender (?) -// buffers for UDP parallel processing -var udpBufs = make(chan []byte, 1<<8) - func (s *Server) startUDP() { bind, err := net.ResolveUDPAddr("udp", s.configuration.BindAddress) if err != nil { @@ -63,6 +59,8 @@ func (s *Server) startUDP() { ).WithFields( s.configuration.LogFields(), ).Info("Listen") + + udpBufs := make(chan []byte, 1<<8) udpBufs <- make([]byte, govpn.MTUMax) go func() { var buf []byte