From fcb34f3206aa8f8293cb379b2b4f0538d4288dec Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Thu, 7 Mar 2013 22:47:57 +0000 Subject: [PATCH] added client to cmd dispatcher --- door_daemon_go/unix_socket_server.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) } -- 1.7.10.4