ReadRequestBody override default rpc.ServerCodec behaviour and inject remote node id into request.
(body interface{})
| 41 | |
| 42 | // ReadRequestBody override default rpc.ServerCodec behaviour and inject remote node id into request. |
| 43 | func (nc *NodeAwareServerCodec) ReadRequestBody(body interface{}) (err error) { |
| 44 | err = nc.ServerCodec.ReadRequestBody(body) |
| 45 | if err != nil { |
| 46 | return |
| 47 | } |
| 48 | |
| 49 | // test if request contains rpc envelope |
| 50 | if body == nil { |
| 51 | return |
| 52 | } |
| 53 | |
| 54 | if r, ok := body.(proto.EnvelopeAPI); ok { |
| 55 | // inject node id to rpc envelope |
| 56 | r.SetNodeID(nc.NodeID) |
| 57 | // inject context |
| 58 | r.SetContext(nc.Ctx) |
| 59 | } |
| 60 | |
| 61 | return |
| 62 | } |
nothing calls this directly
no test coverage detected