Browse Source

Add comments about goroutine-safety

pull/456/head
Jae Kwon 9 years ago
parent
commit
8b7969d6ea
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      server/handlers.go

+ 2
- 0
server/handlers.go View File

@ -347,6 +347,7 @@ func (wsc *wsConnection) GetEventSwitch() *events.EventSwitch {
// Implements WSRPCConnection
// Blocking write to writeChan until service stops.
// Goroutine-safe
func (wsc *wsConnection) WriteRPCResponse(resp RPCResponse) {
select {
case <-wsc.Quit:
@ -357,6 +358,7 @@ func (wsc *wsConnection) WriteRPCResponse(resp RPCResponse) {
// Implements WSRPCConnection
// Nonblocking write.
// Goroutine-safe
func (wsc *wsConnection) TryWriteRPCResponse(resp RPCResponse) bool {
select {
case <-wsc.Quit:


Loading…
Cancel
Save