put back connection closing.
This commit is contained in:
parent
317a7d961a
commit
6ff219420b
2 changed files with 18 additions and 4 deletions
|
@ -84,13 +84,20 @@ func (s *Server) listenAndServe(listener net.Listener) {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
} else {
|
} else {
|
||||||
s.stop.Add(1)
|
s.stop.Add(1)
|
||||||
go s.handleConnection(conn)
|
go func() {
|
||||||
|
s.stop.Done()
|
||||||
|
s.handleConnection(conn)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleConnection(conn net.Conn) {
|
func (s *Server) handleConnection(conn net.Conn) {
|
||||||
defer s.stop.Done()
|
defer func() {
|
||||||
|
if err := conn.Close(); err != nil {
|
||||||
|
log.Error("error closing client connection for peer server - ", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
timeoutDuration := 5 * time.Second
|
timeoutDuration := 5 * time.Second
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
|
@ -74,13 +74,20 @@ func (s *Server) listenAndServe(listener net.Listener) {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
} else {
|
} else {
|
||||||
s.stop.Add(1)
|
s.stop.Add(1)
|
||||||
go s.handleConn(conn)
|
go func() {
|
||||||
|
s.stop.Done()
|
||||||
|
s.handleConn(conn)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleConn(conn net.Conn) {
|
func (s *Server) handleConn(conn net.Conn) {
|
||||||
defer s.stop.Done()
|
defer func() {
|
||||||
|
if err := conn.Close(); err != nil {
|
||||||
|
log.Error("error closing client connection for reflector server - ", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
// TODO: connection should time out eventually
|
// TODO: connection should time out eventually
|
||||||
err := s.doHandshake(conn)
|
err := s.doHandshake(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue