From 05f5975f0266e628e89cf0f60f84f47d43136747 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Tue, 24 Sep 2013 07:53:28 +0000 Subject: [PATCH] --whitespace --- go/door_client_zmq/main.go | 4 ++-- go/door_client_zmq/zeromq.go | 6 +++--- go/door_daemon_zmq/handle_commands.go | 4 ++-- go/door_daemon_zmq/main.go | 10 +++++----- go/door_daemon_zmq/zeromq.go | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go/door_client_zmq/main.go b/go/door_client_zmq/main.go index 4db2f1e..2c2afe3 100644 --- a/go/door_client_zmq/main.go +++ b/go/door_client_zmq/main.go @@ -48,7 +48,7 @@ func LineReader(out chan <- [][]byte, stdin * os.File) { } } -func main() { +func main() { cmd_chans, sub_chans := ZmqsInit(cmd_port_, sub_port_) defer cmd_chans.Close() defer sub_chans.Close() @@ -58,7 +58,7 @@ func main() { user_input_chan := make(chan [][]byte, 1) go LineReader(user_input_chan, os.Stdin) defer os.Stdin.Close() - + for { select { case input, input_open := (<- user_input_chan): diff --git a/go/door_client_zmq/zeromq.go b/go/door_client_zmq/zeromq.go index b74ca5e..4b3b87d 100644 --- a/go/door_client_zmq/zeromq.go +++ b/go/door_client_zmq/zeromq.go @@ -16,13 +16,13 @@ func ZmqsInit(cmd_port, sub_port string) (cmd_chans, pub_chans *zmq.Channels) { } //close only on panic, otherwise leave open: defer func(){ if r:= recover(); r != nil { cmd_ctx.Close(); panic(r) } }() - + pub_ctx, err := zmq.NewContext() if err != nil { panic(err) } defer func() { if r:= recover(); r != nil { pub_ctx.Close(); panic(r) } }() - + cmd_sock, err := cmd_ctx.Socket(zmq.Req) if err != nil { panic(err) @@ -42,7 +42,7 @@ func ZmqsInit(cmd_port, sub_port string) (cmd_chans, pub_chans *zmq.Channels) { if err = pub_sock.Bind(sub_port); err != nil { panic(err) } - + cmd_chans = cmd_sock.Channels() pub_chans = cmd_sock.Channels() go zmqsHandleError(cmd_chans, pub_chans) diff --git a/go/door_daemon_zmq/handle_commands.go b/go/door_daemon_zmq/handle_commands.go index d33070a..2ac73ac 100644 --- a/go/door_daemon_zmq/handle_commands.go +++ b/go/door_daemon_zmq/handle_commands.go @@ -50,7 +50,7 @@ func HandleCommand(tokens [][]byte, topub chan <- [][]byte, serial_wr chan strin if len(tokens) < 1 { return nil, errors.New("No Command to handle") } - + dch, present := cmdToDoorCmdHandler[string(tokens[0])] if ! present { return nil, errors.New("Unknown Command") @@ -60,7 +60,7 @@ func HandleCommand(tokens [][]byte, topub chan <- [][]byte, serial_wr chan strin //return error to sender return nil, err } - + topub <- tokens serial_wr <- dch.FirmwareChar fw_reply := <- serial_rd diff --git a/go/door_daemon_zmq/main.go b/go/door_daemon_zmq/main.go index 8b359d0..9fa4531 100644 --- a/go/door_daemon_zmq/main.go +++ b/go/door_daemon_zmq/main.go @@ -43,15 +43,15 @@ func main() { usage() os.Exit(1); } - - cmd_chans, pub_chans := ZmqsInit(cmd_port_, pub_port_) - + + cmd_chans, pub_chans := ZmqsInit(cmd_port_, pub_port_) + serial_wr, serial_rd, err := OpenAndHandleSerial(args[0], pub_chans.Out()) if err != nil { close(serial_wr) panic(err) } - + serial_wr <- "f" firmware_version := <- serial_rd log.Print("Firmware version:", firmware_version) @@ -63,6 +63,6 @@ func main() { log.Print(err) } else { cmd_chans.Out() <- reply - } + } } } diff --git a/go/door_daemon_zmq/zeromq.go b/go/door_daemon_zmq/zeromq.go index 70fe795..cec7089 100644 --- a/go/door_daemon_zmq/zeromq.go +++ b/go/door_daemon_zmq/zeromq.go @@ -16,13 +16,13 @@ func ZmqsInit(cmd_port, pub_port string) (cmd_chans, pub_chans *zmq.Channels) { } //close only on panic, otherwise leave open: defer func(){ if r:= recover(); r != nil { cmd_ctx.Close(); panic(r) } }() - + pub_ctx, err := zmq.NewContext() if err != nil { panic(err) } defer func() { if r:= recover(); r != nil { pub_ctx.Close(); panic(r) } }() - + cmd_sock, err := cmd_ctx.Socket(zmq.Rep) if err != nil { panic(err) @@ -42,7 +42,7 @@ func ZmqsInit(cmd_port, pub_port string) (cmd_chans, pub_chans *zmq.Channels) { if err = pub_sock.Bind(pub_port); err != nil { // "tcp://*:5556" panic(err) } - + cmd_chans = cmd_sock.Channels() pub_chans = cmd_sock.Channels() go zmqsHandleError(cmd_chans, pub_chans) -- 1.7.10.4