Exemple #1
0
func (c *clientCodec) WriteRequest(r *rpc.Request, body interface{}) error {
	var param proto.Message
	if body != nil {
		var ok bool
		if param, ok = body.(proto.Message); !ok {
			return fmt.Errorf("%T does not implement proto.Message", body)
		}
	}

	var req protorpcpb.Request
	req.Method = proto.String(r.ServiceMethod)
	req.Seq = proto.Uint64(r.Seq)
	return writeMessage(c.rwc, &req, param)
}