From 0b7e77d4909035d001bed7633b914f41846d283e Mon Sep 17 00:00:00 2001 From: Silver Date: Mon, 15 Jan 2018 17:27:08 -0500 Subject: [PATCH] Code review --- .gitignore | 1 + server.go | 2 +- session.go | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index df0ca86..83df278 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.test *.cpuprofile +*.swp diff --git a/server.go b/server.go index 78951f7..51abed2 100644 --- a/server.go +++ b/server.go @@ -150,7 +150,7 @@ func getImg(r *http.Request) (io.ReadCloser, error) { func main() { runtime.GOMAXPROCS(4) - port := "localhost:4000" + port := "0.0.0.0:4000" fmt.Println("Running on", port) http.HandleFunc("/", fileHandler) diff --git a/session.go b/session.go index ba571cb..b114ccb 100644 --- a/session.go +++ b/session.go @@ -21,9 +21,7 @@ func newClient(conn *websocket.Conn) *Client { // The Dispatcher; we spawn one for every client func (c *Client) tx() { - defer func() { - c.conn.Close() - }() + defer c.conn.Close() for { event, ok := <-c.broadcast