zoukankan      html  css  js  c++  java
  • Modification should be made to copies of the returned MD.

    C:/Go/pkg/mod/google.golang.org/grpc@v1.29.1/metadata/metadata.go:180


    // FromOutgoingContextRaw returns the un-merged, intermediary contents
    // of rawMD. Remember to perform strings.ToLower on the keys. The returned
    // MD should not be modified. Writing to it may cause races. Modification
    // should be made to copies of the returned MD.
    //
    // This is intended for gRPC-internal use ONLY.
    func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) {
    raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD)
    if !ok {
    return nil, nil, false
    }

    return raw.md, raw.added, true
    }

    // FromOutgoingContext returns the outgoing metadata in ctx if it exists. The
    // returned MD should not be modified. Writing to it may cause races.
    // Modification should be made to copies of the returned MD.
    func FromOutgoingContext(ctx context.Context) (MD, bool) {
    raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD)
    if !ok {
    return nil, false
    }

    mds := make([]MD, 0, len(raw.added)+1)
    mds = append(mds, raw.md)
    for _, vv := range raw.added {
    mds = append(mds, Pairs(vv...))
    }
    return Join(mds...), ok
    }
  • 相关阅读:
    python 单例模式
    JAVA基础知识总结
    java环境配置
    VScode输出中文乱码的解决方法------测试过可以用
    centos7 单独安装pip
    pyqt5信号与槽
    桌面程序显示到前台
    下载哔哩哔哩视频
    pyqt5 designer安装步骤
    树莓派配置静态wifi地址
  • 原文地址:https://www.cnblogs.com/rsapaper/p/14862618.html
Copyright © 2011-2022 走看看