From d1628cb76ac4f907d8e57346809e3ac0b8e12de5 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 10 Jul 2026 20:01:03 +0200 Subject: base integraion of command-registry system --- main.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index a7f6d47..84580bf 100644 --- a/main.go +++ b/main.go @@ -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 -- cgit v1.2.3