From a3d9c8941a295eacd45da555ed2548c1cb658254 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 23 Mar 2018 13:42:39 +0900 Subject: [PATCH] ing --- client/client_rwc_handlers.go | 4 ++-- client/rwc/socket/client_rwc_handlers.go | 8 ++++---- .../websocket/fasthttp/client_rwc_handlers.go | 10 +++++----- server/rwc/socket/servlet_rwc_handlers.go | 12 ++++++------ .../websocket/fasthttp/servlet_rwc_handlers.go | 16 ++++++++-------- servlet_rwc_handlers.go | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/client/client_rwc_handlers.go b/client/client_rwc_handlers.go index b2e8f8d..6e98f42 100644 --- a/client/client_rwc_handlers.go +++ b/client/client_rwc_handlers.go @@ -8,8 +8,8 @@ import ( ) type ClientReadWriteCloseHandlers struct { - ReadMtx sync.RWMutex - WriteMtx sync.RWMutex + ReadMtx sync.Mutex + WriteMtx sync.Mutex } func (crwch *ClientReadWriteCloseHandlers) Connect(clientCTX ClientContext) (interface{}, error) { diff --git a/client/rwc/socket/client_rwc_handlers.go b/client/rwc/socket/client_rwc_handlers.go index f7ad15b..95d2516 100644 --- a/client/rwc/socket/client_rwc_handlers.go +++ b/client/rwc/socket/client_rwc_handlers.go @@ -27,9 +27,9 @@ func (crwch *ClientReadWriteCloseHandlers) Connect(clientCTX client.ClientContex func (crwch *ClientReadWriteCloseHandlers) ReadResponse(clientCTX client.ClientContext, codec protocol.ClientCodec, conn interface{}) (protocol.ClientResponseCodec, error) { soc := conn.(csc.Socket) - crwch.ReadMtx.RLock() + crwch.ReadMtx.Lock() resCodec, err := codec.NewResponse(soc) - crwch.ReadMtx.RUnlock() + crwch.ReadMtx.Unlock() return resCodec, err } @@ -40,9 +40,9 @@ func (crwch *ClientReadWriteCloseHandlers) WriteRequest(clientCTX client.ClientC ) soc := conn.(csc.Socket) - crwch.WriteMtx.RLock() + crwch.WriteMtx.Lock() wErr = codec.WriteRequest(soc, method, params, id) - crwch.WriteMtx.RUnlock() + crwch.WriteMtx.Unlock() return wErr } diff --git a/client/rwc/websocket/fasthttp/client_rwc_handlers.go b/client/rwc/websocket/fasthttp/client_rwc_handlers.go index 071605c..05c85f8 100644 --- a/client/rwc/websocket/fasthttp/client_rwc_handlers.go +++ b/client/rwc/websocket/fasthttp/client_rwc_handlers.go @@ -30,10 +30,10 @@ func (crwch *ClientReadWriteCloseHandlers) Connect(clientCTX client.ClientContex func (crwch *ClientReadWriteCloseHandlers) ReadResponse(clientCTX client.ClientContext, codec protocol.ClientCodec, conn interface{}) (protocol.ClientResponseCodec, error) { soc := conn.(cwfc.Socket) - crwch.ReadMtx.RLock() + crwch.ReadMtx.Lock() _, r, err := soc.NextReader() resCodec, err := codec.NewResponse(r) - crwch.ReadMtx.RUnlock() + crwch.ReadMtx.Unlock() return resCodec, err } @@ -45,10 +45,10 @@ func (crwch *ClientReadWriteCloseHandlers) WriteRequest(clientCTX client.ClientC ) soc := conn.(cwfc.Socket) - crwch.WriteMtx.RLock() + crwch.WriteMtx.Lock() wc, wErr = soc.NextWriter(websocket.TextMessage) if nil != wErr { - crwch.WriteMtx.RUnlock() + crwch.WriteMtx.Unlock() return wErr } defer func() { @@ -57,7 +57,7 @@ func (crwch *ClientReadWriteCloseHandlers) WriteRequest(clientCTX client.ClientC wErr = codec.WriteRequest(wc, method, params, id) - crwch.WriteMtx.RUnlock() + crwch.WriteMtx.Unlock() return wErr } diff --git a/server/rwc/socket/servlet_rwc_handlers.go b/server/rwc/socket/servlet_rwc_handlers.go index 372e348..e3b9b1c 100644 --- a/server/rwc/socket/servlet_rwc_handlers.go +++ b/server/rwc/socket/servlet_rwc_handlers.go @@ -17,9 +17,9 @@ type ServletReadWriteCloseHandlers struct { func (srwch *ServletReadWriteCloseHandlers) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) { soc := conn.(server.Socket) - srwch.ReadMtx.RLock() + srwch.ReadMtx.Lock() reqCodec, err := codec.NewRequest(soc) - srwch.ReadMtx.RUnlock() + srwch.ReadMtx.Unlock() return reqCodec, err } @@ -30,13 +30,13 @@ func (srwch *ServletReadWriteCloseHandlers) WriteResponse(servletCTX rpc.Servlet ) soc := conn.(server.Socket) - srwch.WriteMtx.RLock() + srwch.WriteMtx.Lock() if nil != err { wErr = reqCodec.WriteError(soc, 500, err) } else { wErr = reqCodec.WriteResponse(soc, result) } - srwch.WriteMtx.RUnlock() + srwch.WriteMtx.Unlock() return wErr } @@ -47,9 +47,9 @@ func (srwch *ServletReadWriteCloseHandlers) WriteNotification(servletCTX rpc.Ser ) soc := conn.(server.Socket) - srwch.WriteMtx.RLock() + srwch.WriteMtx.Lock() wErr = codec.WriteNotification(soc, method, params) - srwch.WriteMtx.RUnlock() + srwch.WriteMtx.Unlock() return wErr } diff --git a/server/rwc/websocket/fasthttp/servlet_rwc_handlers.go b/server/rwc/websocket/fasthttp/servlet_rwc_handlers.go index 2c5d935..2b4f0c2 100644 --- a/server/rwc/websocket/fasthttp/servlet_rwc_handlers.go +++ b/server/rwc/websocket/fasthttp/servlet_rwc_handlers.go @@ -20,10 +20,10 @@ type ServletReadWriteCloseHandlers struct { func (srwch *ServletReadWriteCloseHandlers) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) { soc := conn.(cwf.Socket) - srwch.ReadMtx.RLock() + srwch.ReadMtx.Lock() _, r, err := soc.NextReader() requestCodec, err := codec.NewRequest(r) - srwch.ReadMtx.RUnlock() + srwch.ReadMtx.Unlock() return requestCodec, err } @@ -35,10 +35,10 @@ func (srwch *ServletReadWriteCloseHandlers) WriteResponse(servletCTX rpc.Servlet ) soc := conn.(cwf.Socket) - srwch.WriteMtx.RLock() + srwch.WriteMtx.Lock() wc, wErr = soc.NextWriter(websocket.TextMessage) if nil != wErr { - srwch.WriteMtx.RUnlock() + srwch.WriteMtx.Unlock() return wErr } @@ -51,7 +51,7 @@ func (srwch *ServletReadWriteCloseHandlers) WriteResponse(servletCTX rpc.Servlet } else { wErr = requestCodec.WriteResponse(wc, result) } - srwch.WriteMtx.RUnlock() + srwch.WriteMtx.Unlock() return wErr } @@ -63,10 +63,10 @@ func (srwch *ServletReadWriteCloseHandlers) WriteNotification(servletCTX rpc.Ser ) soc := conn.(cwf.Socket) - srwch.WriteMtx.RLock() + srwch.WriteMtx.Lock() wc, wErr = soc.NextWriter(websocket.TextMessage) if nil != wErr { - srwch.WriteMtx.RUnlock() + srwch.WriteMtx.Unlock() return wErr } @@ -75,7 +75,7 @@ func (srwch *ServletReadWriteCloseHandlers) WriteNotification(servletCTX rpc.Ser }() wErr = codec.WriteNotification(wc, method, params) - srwch.WriteMtx.RUnlock() + srwch.WriteMtx.Unlock() return wErr } diff --git a/servlet_rwc_handlers.go b/servlet_rwc_handlers.go index b6fc252..59a2973 100644 --- a/servlet_rwc_handlers.go +++ b/servlet_rwc_handlers.go @@ -8,8 +8,8 @@ import ( ) type ServletReadWriteCloseHandlers struct { - ReadMtx sync.RWMutex - WriteMtx sync.RWMutex + ReadMtx sync.Mutex + WriteMtx sync.Mutex } func (srwch *ServletReadWriteCloseHandlers) ReadRequest(servletCTX ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {