This commit is contained in:
iamqizhao
2015-10-01 17:55:23 -07:00
3 changed files with 8 additions and 0 deletions

View File

@ -289,6 +289,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
traceInfo.tr = stream.Trace()
defer traceInfo.tr.Finish()
traceInfo.firstLine.client = false
traceInfo.firstLine.remoteAddr = t.RemoteAddr()
traceInfo.tr.LazyLog(&traceInfo.firstLine, false)
defer func() {
if err != nil && err != io.EOF {
@ -393,6 +394,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
//ss.traceInfo.tr = trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method())
ss.traceInfo.tr = stream.Trace()
ss.traceInfo.firstLine.client = false
ss.traceInfo.firstLine.remoteAddr = t.RemoteAddr()
ss.traceInfo.tr.LazyLog(&ss.traceInfo.firstLine, false)
ss.ctx = trace.NewContext(ss.ctx, ss.traceInfo.tr)
defer func() {

View File

@ -696,3 +696,7 @@ func (t *http2Server) closeStream(s *Stream) {
// other goroutines.
s.cancel()
}
func (t *http2Server) RemoteAddr() net.Addr {
return t.conn.RemoteAddr()
}

View File

@ -398,6 +398,8 @@ type ServerTransport interface {
// should not be accessed any more. All the pending streams and their
// handlers will be terminated asynchronously.
Close() error
// RemoteAddr returns the remote network address.
RemoteAddr() net.Addr
}
// StreamErrorf creates an StreamError with the specified error code and description.