aboutsummaryrefslogtreecommitdiff
path: root/weed/wdclient/masterclient.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@uber.com>2019-03-15 17:20:24 -0700
committerChris Lu <chris.lu@uber.com>2019-03-15 17:20:24 -0700
commit55bab1b456c3c13a8009a11730e678ca0c48dfb0 (patch)
treec7609b465c8444fc7538cb7f9392011840e1b38c /weed/wdclient/masterclient.go
parentcece860bfde443d4f8cddb04b10fb98a998995ed (diff)
downloadseaweedfs-55bab1b456c3c13a8009a11730e678ca0c48dfb0.tar.xz
seaweedfs-55bab1b456c3c13a8009a11730e678ca0c48dfb0.zip
add context.Context
Diffstat (limited to 'weed/wdclient/masterclient.go')
-rw-r--r--weed/wdclient/masterclient.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go
index 3600fe7c7..34069b3c3 100644
--- a/weed/wdclient/masterclient.go
+++ b/weed/wdclient/masterclient.go
@@ -53,7 +53,7 @@ func (mc *MasterClient) KeepConnectedToMaster() {
func (mc *MasterClient) tryAllMasters() {
for _, master := range mc.masters {
glog.V(0).Infof("Connecting to master %v", master)
- gprcErr := withMasterClient(master, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
+ gprcErr := withMasterClient(context.Background(), master, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
stream, err := client.KeepConnected(context.Background())
if err != nil {
@@ -99,14 +99,14 @@ func (mc *MasterClient) tryAllMasters() {
}
}
-func withMasterClient(master string, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) error {
+func withMasterClient(ctx context.Context, master string, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) error {
masterGrpcAddress, parseErr := util.ParseServerToGrpcAddress(master, 0)
if parseErr != nil {
return fmt.Errorf("failed to parse master grpc %v", master)
}
- grpcConnection, err := util.GrpcDial(masterGrpcAddress, grpcDialOption)
+ grpcConnection, err := util.GrpcDial(ctx, masterGrpcAddress, grpcDialOption)
if err != nil {
return fmt.Errorf("fail to dial %s: %v", master, err)
}