public void SendResponse <T>(RpcResponseHeader header, T results) { _context.RetCode = RpcErrorCode.OK; _context.HasBody = header.HasBody; if (header.HasBody) { RpcPipeStreamHelper.WriteStream <T>(_stream, _context, results); _stream.Disconnect(); _channel.RecycleServerStream(_stream); } else { RpcPipeStreamHelper.WriteStream <RpcNull>(_stream, _context, null); _stream.Disconnect(); _channel.RecycleServerStream(_stream); } }
public override void SendResponse(RpcResponse response) { try { _context.RetCode = response.ErrorCode; _context.HasBody = response.BodyBuffer != null; if (_context.HasBody) { byte[] buffer = response.BodyBuffer.GetByteArray(); RpcPipeStreamHelper.WriteStream(_stream, _context, buffer); } else { RpcPipeStreamHelper.WriteStream(_stream, _context, null); } } finally { _stream.Disconnect(); _channel.RecycleServerStream(_stream); } }