From 2e8f154f34504764630e6428cd4aa08d9a9a7eea Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Jul 2015 19:04:53 -0700 Subject: [PATCH 1/2] Iodine should indent with EmitJSON() --- commands.go | 3 +++ pkg/iodine/iodine.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index f25f04a83..319a389ba 100644 --- a/commands.go +++ b/commands.go @@ -85,6 +85,9 @@ func getServerConfig(c *cli.Context) api.Config { } func runServer(c *cli.Context) { + if c.Args().Present() { + cli.ShowCommandHelpAndExit(c, "server", 1) + } _, err := user.Current() if err != nil { Fatalf("Unable to determine current user. Reason: %s\n", err) diff --git a/pkg/iodine/iodine.go b/pkg/iodine/iodine.go index 96903052a..c0b78583d 100644 --- a/pkg/iodine/iodine.go +++ b/pkg/iodine/iodine.go @@ -1,5 +1,5 @@ /* - * Iodine, (C) 2015 Minio, Inc. + * Minimalist Object Storage, (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -202,7 +202,7 @@ func getSystemData() map[string]string { // EmitJSON writes JSON output for the error func (err Error) EmitJSON() ([]byte, error) { - return json.Marshal(err) + return json.MarshalIndent(err, "", "\t") } // EmitHumanReadable returns a human readable error message From e4574c7d6fc9e9e04572b9dcef5b96cf1ea33084 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 16 Jul 2015 00:06:57 -0700 Subject: [PATCH 2/2] Add File() method to Ratelimitlistener for extracting underlying fd() --- pkg/server/minhttp/listen.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/server/minhttp/listen.go b/pkg/server/minhttp/listen.go index 3053c581c..5792f95e1 100644 --- a/pkg/server/minhttp/listen.go +++ b/pkg/server/minhttp/listen.go @@ -18,6 +18,7 @@ package minhttp import ( "net" + "os" "sync" "github.com/minio/minio/pkg/iodine" @@ -37,6 +38,12 @@ type rateLimitListener struct { func (l *rateLimitListener) accept() { l.sem <- struct{}{} } func (l *rateLimitListener) release() { <-l.sem } +// File - necessary to expose underlying socket fd +func (l *rateLimitListener) File() (f *os.File, err error) { + return l.Listener.(fileListener).File() +} + +// Accept - accept method for accepting new connections func (l *rateLimitListener) Accept() (net.Conn, error) { l.accept()