Remove Port from registry

This commit is contained in:
Asim Aslam 2019-07-08 08:01:42 +01:00 committed by Vasiliy Tolstov
parent e2b8abd86a
commit 5ab3e7e90b
2 changed files with 2 additions and 8 deletions

View File

@ -84,9 +84,6 @@ func (g *grpcClient) next(request client.Request, opts client.CallOptions) (sele
func (g *grpcClient) call(ctx context.Context, node *registry.Node, req client.Request, rsp interface{}, opts client.CallOptions) error { func (g *grpcClient) call(ctx context.Context, node *registry.Node, req client.Request, rsp interface{}, opts client.CallOptions) error {
address := node.Address address := node.Address
if node.Port > 0 {
address = fmt.Sprintf("%s:%d", address, node.Port)
}
header := make(map[string]string) header := make(map[string]string)
if md, ok := metadata.FromContext(ctx); ok { if md, ok := metadata.FromContext(ctx); ok {
@ -146,9 +143,6 @@ func (g *grpcClient) call(ctx context.Context, node *registry.Node, req client.R
func (g *grpcClient) stream(ctx context.Context, node *registry.Node, req client.Request, opts client.CallOptions) (client.Stream, error) { func (g *grpcClient) stream(ctx context.Context, node *registry.Node, req client.Request, opts client.CallOptions) (client.Stream, error) {
address := node.Address address := node.Address
if node.Port > 0 {
address = fmt.Sprintf("%s:%d", address, node.Port)
}
header := make(map[string]string) header := make(map[string]string)
if md, ok := metadata.FromContext(ctx); ok { if md, ok := metadata.FromContext(ctx); ok {

View File

@ -2,6 +2,7 @@ package grpc
import ( import (
"context" "context"
"fmt"
"net" "net"
"strconv" "strconv"
"strings" "strings"
@ -50,8 +51,7 @@ func TestGRPCClient(t *testing.T) {
Nodes: []*registry.Node{ Nodes: []*registry.Node{
&registry.Node{ &registry.Node{
Id: "test-1", Id: "test-1",
Address: addr, Address: fmt.Sprintf("%s:%d", addr, port),
Port: port,
}, },
}, },
}) })