From 89124221fb7ec9fe59db0dbd3ed8d8385f5c48a9 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 5 May 2018 23:53:06 +0200 Subject: [PATCH] minmod --- ws/client.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ws/client.go b/ws/client.go index 38fd34c..2561085 100644 --- a/ws/client.go +++ b/ws/client.go @@ -173,9 +173,11 @@ func clientReader(c *client){ /* (6) Send PONG */ if msg.Type == PING { // fmt.Printf("[reader] PING -> PONG\n") - msg.Final = true - msg.Type = PONG - c.ch.send <- *msg + if c.io.writing { + msg.Final = true + msg.Type = PONG + c.ch.send <- *msg + } continue } @@ -280,8 +282,6 @@ func (c *client) close(status MessageError, clientACK bool){ Data: make([]byte, 2), } binary.BigEndian.PutUint16(msg.Data, uint16(status)) - // msg.Data = append(msg.Data, []byte("(closing)")...) - msg.Size = uint( len(msg.Data) ) /* (4) Send message */ err := msg.Send(c.io.sock)