refactoring

This commit is contained in:
Chris Lu
2020-04-12 20:48:21 -07:00
parent b062393f3f
commit 8e23dc078b
3 changed files with 9 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ import (
"google.golang.org/grpc/peer"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/storage/backend"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
@@ -191,8 +192,8 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
peerAddress := findClientAddress(stream.Context(), req.GrpcPort)
// only one shell can be connected at any time
if req.Name == "shell" {
if ms.currentAdminShellClient == ""{
if req.Name == pb.AdminShellClient {
if ms.currentAdminShellClient == "" {
ms.currentAdminShellClient = peerAddress
defer func() {
ms.currentAdminShellClient = ""
@@ -202,7 +203,6 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
}
}
stopChan := make(chan bool)
clientName, messageChan := ms.addClient(req.Name, peerAddress)