这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func (c *Conn) handle(cmd string, arg string) {
}()

if cmd == "" {
c.nbrErrors++
if c.nbrErrors > 3 {
c.WriteResponse(500, EnhancedCode{5, 5, 2}, "Too many errors")
c.Close()
}
c.WriteResponse(500, EnhancedCode{5, 5, 2}, "Speak up")
return
}
Expand Down
5 changes: 5 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ func (s *Server) handleConn(c *Conn) error {
cmd, arg, err := parseCmd(line)
if err != nil {
c.nbrErrors++
if c.nbrErrors > 3 {
c.WriteResponse(500, EnhancedCode{5, 5, 2}, "Too many errors")
c.Close()
}

c.WriteResponse(501, EnhancedCode{5, 5, 2}, "Bad command")
continue
}
Expand Down