Github user dcelasun commented on the issue:

    https://github.com/apache/thrift/pull/1459
  
    > I personally think dropping go1.6/x/net/context support is best for the 
project. Are you the right person to make that call?
    
    Sounds good to me, but we need to run it by someone with commit bits. cc 
@Jens-G @jeking3 
    
    > Related question: why was 'context support' added when it doesn't seem to 
be hooked up to anything in the library? Seems like the method signatures were 
the only thing that changed.
    
    It was added to support passing arbitrary values into RPC handlers. One of 
the big use cases was accessing client IP from an RPC handler. Before 
`context`, this was impossible since the underlying transport was not visible 
to the handler. Now, you can implement a custom `TProcessor` that embeds the 
generated processor, and pass the IP manually, something like:
    
    ```go
    type MyProcessor struct {
        *GeneratedProcessor
    }
    
    func (p *MyProcessor) Process(ctx context.Context, in, out TProtocol) 
(bool, TException) {
        name, _, seqId, err := iprot.ReadMessageBegin()
                if err != nil {
                        return false, err
                }
                if processor, ok := p.GetProcessorFunction(name); ok {
                        //TODO: get IP from transport and add to ctx
                
                        return processor.Process(ctx, seqId, iprot, oprot)
                }
                
                // rest of it...
        }
    }
    
    ```


---

Reply via email to