close session if reading from the socket fails in the server

fixes #425
This commit is contained in:
Marten Seemann
2017-05-04 13:15:20 +08:00
parent 53583059d9
commit eacd994e67
2 changed files with 12 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ func (s *server) Serve() error {
// If it does, we only read a truncated packet, which will then end up undecryptable
n, remoteAddr, err := s.conn.ReadFrom(data)
if err != nil {
_ = s.Close()
return err
}
data = data[:n]