Browse Source

Remove session on disconnect

pool
Sammy Libre 8 years ago
parent
commit
5d795dc56d
  1. 4
      go-pool/stratum/stratum.go

4
go-pool/stratum/stratum.go

@ -186,10 +186,10 @@ func (s *StratumServer) handleClient(cs *Session, e *Endpoint) error {
data, isPrefix, err := connbuff.ReadLine() data, isPrefix, err := connbuff.ReadLine()
if isPrefix { if isPrefix {
log.Printf("Socket flood detected") log.Printf("Socket flood detected")
// TODO: Ban client
return errors.New("Socket flood") return errors.New("Socket flood")
} else if err == io.EOF { } else if err == io.EOF {
log.Printf("Client disconnected") log.Println("Client disconnected", cs.ip)
s.removeSession(cs)
break break
} else if err != nil { } else if err != nil {
log.Printf("Error reading: %v", err) log.Printf("Error reading: %v", err)

Loading…
Cancel
Save