Remove Port from registry
This commit is contained in:
parent
e2b8abd86a
commit
5ab3e7e90b
6
grpc.go
6
grpc.go
@ -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 {
|
||||||
|
@ -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{
|
||||||
®istry.Node{
|
®istry.Node{
|
||||||
Id: "test-1",
|
Id: "test-1",
|
||||||
Address: addr,
|
Address: fmt.Sprintf("%s:%d", addr, port),
|
||||||
Port: port,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user