From d03e08b466fbcc1a287aba1ef38cfca965d03708 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 5 May 2018 18:47:38 +0200 Subject: [PATCH] opti --- ws/client.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ws/client.go b/ws/client.go index 308b7dd..38fd34c 100644 --- a/ws/client.go +++ b/ws/client.go @@ -257,15 +257,16 @@ func (c *client) close(status MessageError, clientACK bool){ return } - /* (2) kill reader if still running */ - c.io.sock.SetReadDeadline(time.Now().Add(time.Second*-1)) - c.io.reading.Wait() - - /* (3) kill writer' if still running */ + /* (2) kill writer' if still running */ if c.io.writing { close(c.ch.send) } + /* (3) kill reader if still running */ + c.io.sock.SetReadDeadline(time.Now().Add(time.Second*-1)) + c.io.reading.Wait() + + if status == NONE { status = NORMAL