diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 15 |
1 files changed, 1 insertions, 14 deletions
@@ -2,7 +2,6 @@ package main import ( "bufio" - "errors" "fmt" "net" "os" @@ -118,19 +117,7 @@ func handleConnection(conn net.Conn) { command := strings.ToUpper(args[0]) - switch { - case baseCommandRegistry[command] != nil: - handler := baseCommandRegistry[command] - conn.Write(serializeRESP(handler(args))) - - case connectionCommandRegistry[command] != nil: - handler := connectionCommandRegistry[command] - handler(conn, args) - - default: - errMsg := fmt.Sprintf("ERR unknown command '%s'", command) - conn.Write(serializeRESP(errors.New(errMsg))) - } + conn.Write(serializeRESP(DispatchBaseCommand(command,args))) } }
\ No newline at end of file |
