From 863237b5184b8f721799b963f00f44862a02b209 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Mon, 15 Aug 2016 17:53:11 +0800 Subject: [PATCH] Justify lock use --- transport/internet/ws/wsconn.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/transport/internet/ws/wsconn.go b/transport/internet/ws/wsconn.go index 1f59b4cd..9c5658c1 100644 --- a/transport/internet/ws/wsconn.go +++ b/transport/internet/ws/wsconn.go @@ -160,6 +160,14 @@ func (ws *wsconn) SetWriteDeadline(t time.Time) error { func (ws *wsconn) setup() { ws.connClosing = false + /* + https://godoc.org/github.com/gorilla/websocket#Conn.NextReader + https://godoc.org/github.com/gorilla/websocket#Conn.NextWriter + + Both Read and write access are exclusive. + And in both case it will need a lock. + + */ ws.rlock = &sync.Mutex{} ws.wlock = &sync.Mutex{}