From: Othmar Gsenger Date: Thu, 7 Mar 2013 22:47:57 +0000 (+0000) Subject: added client to cmd dispatcher X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=fcb34f3206aa8f8293cb379b2b4f0538d4288dec;p=svn42.git added client to cmd dispatcher --- diff --git a/door_daemon_go/unix_socket_server.go b/door_daemon_go/unix_socket_server.go index ee5429f..1d5424b 100644 --- a/door_daemon_go/unix_socket_server.go +++ b/door_daemon_go/unix_socket_server.go @@ -4,7 +4,7 @@ import "net" import "bufio" import "strings" -var cmdHandler = map[string]func([]string,string) { +var cmdHandler = map[string]func([]string,string,*bufio.ReadWriter ) { "test":handleCmdTest, } @@ -60,21 +60,21 @@ func handleConnection(c net.Conn) () { fmt.Printf("Received: %v\n", line) tokens:=strings.Fields(line) remainStr:=strings.Join(tokens[1:]," ") - handleCmd(tokens,remainStr) + handleCmd(tokens,remainStr,client) } } -func handleCmd(tokens []string, remainStr string) { +func handleCmd(tokens []string, remainStr string,client * bufio.ReadWriter) { cmd:=tokens[0] func_ptr,present := cmdHandler[cmd] if present { - func_ptr(tokens, remainStr) + func_ptr(tokens, remainStr,client) } else { fmt.Printf("Error: unknown Cmd: %v\n", cmd) } } -func handleCmdTest(tokens []string, remainStr string) { +func handleCmdTest(tokens []string, remainStr string, client * bufio.ReadWriter) { //cmd:=tokens[0] fmt.Printf("Test: %v\n", remainStr) }