summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/server.go
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2018-09-27 19:54:19 +0100
committerAndrea Barberio <insomniac@slackware.it>2018-09-27 19:54:19 +0100
commit93e07e83bb197ce356a596dc8e57f134c3ce5fef (patch)
tree60726eee6e99d2b5e533b4fc3fb6b55b3847d2d2 /dhcpv6/server.go
parentb293b7a48193366eb21f2d3d747ea039f08ff837 (diff)
Addressed feedback
Diffstat (limited to 'dhcpv6/server.go')
-rw-r--r--dhcpv6/server.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/dhcpv6/server.go b/dhcpv6/server.go
index 4dbb0e1..3fade87 100644
--- a/dhcpv6/server.go
+++ b/dhcpv6/server.go
@@ -67,7 +67,7 @@ type Server struct {
localAddr net.UDPAddr
}
-// LocalAddr returns the local address of the listening socked, or nil if not
+// LocalAddr returns the local address of the listening socket, or nil if not
// listening
func (s *Server) LocalAddr() net.Addr {
s.connMutex.Lock()
@@ -88,6 +88,10 @@ func (s *Server) ActivateAndServe() error {
}
s.conn = conn
}
+ defer func() {
+ s.conn.Close()
+ s.conn = nil
+ }()
s.connMutex.Unlock()
var (
pc *net.UDPConn
@@ -102,7 +106,6 @@ func (s *Server) ActivateAndServe() error {
log.Printf("Server listening on %s", pc.LocalAddr())
log.Print("Ready to handle requests")
for {
- log.Printf("CHECK")
select {
case <-s.shouldStop:
break
@@ -129,7 +132,6 @@ func (s *Server) ActivateAndServe() error {
}
s.Handler(pc, peer, m)
}
- s.conn.Close()
return nil
}