Change the RPC server to use it's own Muxer.
Rather than relying on the http package's DefaultServeMux for the RPC server, create a unique mux specifically for the RPC server. This ensures things, such as the http profiling handlers, do not commingle.
This commit is contained in:
parent
8970d4bf99
commit
5a4772bdc6
1 changed files with 4 additions and 3 deletions
|
@ -156,7 +156,9 @@ func (s *rpcServer) Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("RPCS: Starting RPC server")
|
log.Trace("RPCS: Starting RPC server")
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
rpcServeMux := http.NewServeMux()
|
||||||
|
httpServer := &http.Server{Handler: rpcServeMux}
|
||||||
|
rpcServeMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
login := s.username + ":" + s.password
|
login := s.username + ":" + s.password
|
||||||
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
|
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
|
||||||
authhdr := r.Header["Authorization"]
|
authhdr := r.Header["Authorization"]
|
||||||
|
@ -168,10 +170,9 @@ func (s *rpcServer) Start() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
go s.walletListenerDuplicator()
|
go s.walletListenerDuplicator()
|
||||||
http.Handle("/wallet", websocket.Handler(func(ws *websocket.Conn) {
|
rpcServeMux.Handle("/wallet", websocket.Handler(func(ws *websocket.Conn) {
|
||||||
s.walletReqsNotifications(ws)
|
s.walletReqsNotifications(ws)
|
||||||
}))
|
}))
|
||||||
httpServer := &http.Server{}
|
|
||||||
for _, listener := range s.listeners {
|
for _, listener := range s.listeners {
|
||||||
s.wg.Add(1)
|
s.wg.Add(1)
|
||||||
go func(listener net.Listener) {
|
go func(listener net.Listener) {
|
||||||
|
|
Loading…
Reference in a new issue