fix: use its own lock in serverConfigV17 (#4014)

Previously serverConfigV17 used a global lock that made any instance of
serverConfigV17 depended on single global serverConfigMu.

This patch fixes by having individual lock per instances.
This commit is contained in:
Bala FA
2017-03-31 10:56:24 +05:30
committed by Harshavardhana
parent 2df8160f6a
commit 6e9c91f43a
4 changed files with 127 additions and 159 deletions
+4 -10
View File
@@ -104,17 +104,9 @@ func newGatewayConfig(accessKey, secretKey, region string) error {
SecretKey: secretKey,
})
// Set default printing to console.
srvCfg.Logger.SetConsole(NewConsoleLogger())
// Set custom region.
srvCfg.SetRegion(region)
// Create certs path for SSL configuration.
if err := createConfigDir(); err != nil {
return err
}
// hold the mutex lock before a new config is assigned.
// Save the new config globally.
// unlock the mutex.
@@ -139,8 +131,7 @@ func gatewayMain(ctx *cli.Context) {
// TODO: add support for custom region when we add
// support for S3 backend storage, currently this can
// default to "us-east-1"
err := newGatewayConfig(accessKey, secretKey, "us-east-1")
fatalIf(err, "Unable to initialize gateway config")
newGatewayConfig(accessKey, secretKey, globalMinioDefaultRegion)
// Get quiet flag from command line argument.
quietFlag := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
@@ -151,6 +142,9 @@ func gatewayMain(ctx *cli.Context) {
// First argument is selected backend type.
backendType := ctx.Args().First()
// Create certs path for SSL configuration.
fatalIf(createConfigDir(), "Unable to create configuration directory")
newObject, err := newGatewayLayer(backendType, accessKey, secretKey)
fatalIf(err, "Unable to initialize gateway layer")