mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
bugfix with pub sub name collision with RPC method
This commit is contained in:
parent
2d608d99f8
commit
ad21a50219
3 changed files with 21 additions and 20 deletions
|
|
@ -130,7 +130,7 @@ func (s *Server) ServeCodec(codec ServerCodec) {
|
|||
const size = 64 << 10
|
||||
buf := make([]byte, size)
|
||||
buf = buf[:runtime.Stack(buf, false)]
|
||||
glog.Errorln(buf)
|
||||
glog.Errorln(string(buf))
|
||||
}
|
||||
codec.Close()
|
||||
}()
|
||||
|
|
@ -437,6 +437,7 @@ func (s *Server) readRequest(codec ServerCodec) ([]*serverRequest, bool, RPCErro
|
|||
continue
|
||||
}
|
||||
|
||||
if r.isPubSub { // eth_subscribe
|
||||
if callb, ok := svc.subscriptions[r.method]; ok {
|
||||
requests[i] = &serverRequest{id: r.id, svcname: svc.name, callb: callb}
|
||||
if r.params != nil && len(callb.argTypes) > 0 {
|
||||
|
|
@ -448,6 +449,9 @@ func (s *Server) readRequest(codec ServerCodec) ([]*serverRequest, bool, RPCErro
|
|||
requests[i].err = &invalidParamsError{err.Error()}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
requests[i].err = &methodNotFoundError{subscribeMethod, r.method}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,13 +125,13 @@ METHODS:
|
|||
continue
|
||||
}
|
||||
|
||||
if isPubSub(mtype) {
|
||||
var h callback
|
||||
h.isSubscribe = isPubSub(mtype)
|
||||
h.rcvr = rcvr
|
||||
h.method = method
|
||||
h.errPos = -1
|
||||
h.isSubscribe = true
|
||||
|
||||
if h.isSubscribe {
|
||||
h.argTypes = make([]reflect.Type, mtype.NumIn()-1) // skip rcvr type
|
||||
for i := 1; i < mtype.NumIn(); i++ {
|
||||
argType := mtype.In(i)
|
||||
|
|
@ -146,9 +146,6 @@ METHODS:
|
|||
continue METHODS
|
||||
}
|
||||
|
||||
var h callback
|
||||
h.rcvr = rcvr
|
||||
h.method = method
|
||||
numIn := mtype.NumIn()
|
||||
|
||||
// determine method arguments, ignore first arg since it's the receiver type
|
||||
|
|
|
|||
Loading…
Reference in a new issue