Browse Source

fix: Ensure that the clientAddress is unique (#5655)

pull/5663/head
steve.wei 7 months ago
committed by GitHub
parent
commit
2150289442
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      weed/server/master_grpc_server.go

8
weed/server/master_grpc_server.go

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/google/uuid"
"github.com/seaweedfs/seaweedfs/weed/cluster" "github.com/seaweedfs/seaweedfs/weed/cluster"
"net" "net"
"sort" "sort"
@ -260,7 +261,12 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
return ms.informNewLeader(stream) return ms.informNewLeader(stream)
} }
peerAddress := pb.ServerAddress(req.ClientAddress)
clientAddress := req.ClientAddress
// Ensure that the clientAddress is unique.
if clientAddress == "" {
clientAddress = uuid.New().String()
}
peerAddress := pb.ServerAddress(clientAddress)
// buffer by 1 so we don't end up getting stuck writing to stopChan forever // buffer by 1 so we don't end up getting stuck writing to stopChan forever
stopChan := make(chan bool, 1) stopChan := make(chan bool, 1)

Loading…
Cancel
Save