Skip to content

Commit

Permalink
Fix server open connection leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tengattack committed Jan 4, 2021
1 parent 58f5edc commit a53f084
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ func (s *server) handle(client net.Conn) {
sig := make(chan struct{})

go func() {
defer close(sig)

var buf [1]byte
if _, err := io.ReadFull(client, buf[:]); err != nil {
client.Close()
return
}
close(sig)

for _, m := range s.mux {
if m.mux != buf[0] {
Expand Down

0 comments on commit a53f084

Please sign in to comment.