This commit is contained in:
Łukasz Magiera 2019-07-25 14:54:19 +02:00
parent 0569075442
commit 7ec9d45915
4 changed files with 8 additions and 9 deletions

View File

@ -76,7 +76,7 @@ var runCmd = &cli.Command{
ah := &auth.Handler{ ah := &auth.Handler{
Verify: minerapi.AuthVerify, Verify: minerapi.AuthVerify,
Next: rpcServer.ServeHTTP, Next: rpcServer.ServeHTTP,
} }
http.Handle("/rpc/v0", ah) http.Handle("/rpc/v0", ah)

View File

@ -14,7 +14,7 @@ func serveRPC(a api.FullNode, addr string) error {
ah := &auth.Handler{ ah := &auth.Handler{
Verify: a.AuthVerify, Verify: a.AuthVerify,
Next: rpcServer.ServeHTTP, Next: rpcServer.ServeHTTP,
} }
http.Handle("/rpc/v0", ah) http.Handle("/rpc/v0", ah)

View File

@ -67,7 +67,7 @@ type client struct {
namespace string namespace string
requests chan clientRequest requests chan clientRequest
idCtr int64 idCtr int64
} }
// NewMergeClient is like NewClient, but allows to specify multiple structs // NewMergeClient is like NewClient, but allows to specify multiple structs
@ -143,7 +143,7 @@ func (c *client) makeOutChan(ctx context.Context, ftyp reflect.Type, valOut int)
} }
ch.Send(val.Elem()) // todo: select on ctx is probably a good idea ch.Send(val.Elem()) // todo: select on ctx is probably a good idea
} }
} }
return func() reflect.Value { return retVal }, chCtor return func() reflect.Value { return retVal }, chCtor
@ -192,12 +192,12 @@ type rpcFunc struct {
ftyp reflect.Type ftyp reflect.Type
name string name string
nout int nout int
valOut int valOut int
errOut int errOut int
hasCtx int hasCtx int
retCh bool retCh bool
} }
func (fn *rpcFunc) processResponse(resp clientResponse, rval reflect.Value) []reflect.Value { func (fn *rpcFunc) processResponse(resp clientResponse, rval reflect.Value) []reflect.Value {
@ -290,8 +290,8 @@ func (c *client) makeRpcFunc(f reflect.StructField) (reflect.Value, error) {
fun := &rpcFunc{ fun := &rpcFunc{
client: c, client: c,
ftyp: ftyp, ftyp: ftyp,
name: f.Name, name: f.Name,
} }
fun.valOut, fun.errOut, fun.nout = processFuncOut(ftyp) fun.valOut, fun.errOut, fun.nout = processFuncOut(ftyp)

View File

@ -42,7 +42,6 @@ func (s *RPCServer) handleWS(ctx context.Context, w http.ResponseWriter, r *http
w.Header().Set("Sec-WebSocket-Protocol", r.Header.Get("Sec-WebSocket-Protocol")) w.Header().Set("Sec-WebSocket-Protocol", r.Header.Get("Sec-WebSocket-Protocol"))
} }
c, err := upgrader.Upgrade(w, r, nil) c, err := upgrader.Upgrade(w, r, nil)
if err != nil { if err != nil {
log.Error(err) log.Error(err)