added client to cmd dispatcher
authorOthmar Gsenger <otti@realraum.at>
Thu, 7 Mar 2013 22:47:57 +0000 (22:47 +0000)
committerOthmar Gsenger <otti@realraum.at>
Thu, 7 Mar 2013 22:47:57 +0000 (22:47 +0000)
door_daemon_go/unix_socket_server.go

index ee5429f..1d5424b 100644 (file)
@@ -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)
 }