mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
shell: only one shell is allowed to connect to the cluster
fix https://github.com/chrislusf/seaweedfs/issues/1266
This commit is contained in:
parent
65919d971d
commit
5361f999ed
|
@ -190,6 +190,19 @@ 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 == ""{
|
||||
ms.currentAdminShellClient = peerAddress
|
||||
defer func() {
|
||||
ms.currentAdminShellClient = ""
|
||||
}()
|
||||
} else {
|
||||
return fmt.Errorf("only one concurrent shell allowed, but another shell is already connected from %s", peerAddress)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stopChan := make(chan bool)
|
||||
|
||||
clientName, messageChan := ms.addClient(req.Name, peerAddress)
|
||||
|
|
|
@ -64,6 +64,8 @@ type MasterServer struct {
|
|||
grpcDialOption grpc.DialOption
|
||||
|
||||
MasterClient *wdclient.MasterClient
|
||||
|
||||
currentAdminShellClient string
|
||||
}
|
||||
|
||||
func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *MasterServer {
|
||||
|
|
Loading…
Reference in a new issue