Sending and receving from chans on the same goroutine is a bad idea.
This commit is contained in:
parent
28087af90b
commit
474106a757
1 changed files with 10 additions and 3 deletions
11
sockets.go
11
sockets.go
|
@ -131,10 +131,17 @@ func (s *server) handleRPCRequest(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Errorf("RPCS: Error getting JSON message: %v", err)
|
log.Errorf("RPCS: Error getting JSON message: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessFrontendMsg(frontend, body, false)
|
done := make(chan struct{})
|
||||||
|
go func() {
|
||||||
if _, err := w.Write(<-frontend); err != nil {
|
if _, err := w.Write(<-frontend); err != nil {
|
||||||
log.Warnf("RPCS: could not respond to RPC request: %v", err)
|
log.Warnf("RPCS: could not respond to RPC request: %v",
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
|
close(done)
|
||||||
|
}()
|
||||||
|
|
||||||
|
ProcessFrontendMsg(frontend, body, false)
|
||||||
|
<-done
|
||||||
}
|
}
|
||||||
|
|
||||||
// frontendListenerDuplicator listens for new wallet listener channels
|
// frontendListenerDuplicator listens for new wallet listener channels
|
||||||
|
|
Loading…
Reference in a new issue