From daff377f2d0bcaa075d51286d7392411a93b7509 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 6 Nov 2016 17:08:16 +0300 Subject: [PATCH] create server expression channel for only successful connections Mentioned in #42. --- app.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index cd921a8..c45ced6 100644 --- a/app.go +++ b/app.go @@ -54,13 +54,16 @@ func waitKey() error { func (app *App) handleInp() { clientChan := app.ui.readExpr(app) + var serverChan chan Expr + c, err := net.Dial("unix", gSocketPath) if err != nil { msg := fmt.Sprintf("connecting server: %s", err) app.ui.message = msg log.Printf(msg) + } else { + serverChan = readExpr(c) } - serverChan := readExpr(c) for { select {