mirror of
https://github.com/minio/minio.git
synced 2025-02-24 03:49:12 -05:00
Merge pull request #758 from harshavardhana/pr_out_add_file_method_to_ratelimitlistener_for_extracting_underlying_fd_
Add File() method to Ratelimitlistener for extracting underlying fd()
This commit is contained in:
commit
00a701a155
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user