Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #768 from prashanthpai/server-timeout
Browse files Browse the repository at this point in the history
http: Introduce server timeouts
  • Loading branch information
aravindavk authored May 23, 2018
2 parents 09f1358 + b5e2b49 commit 199dcb8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion glusterd2/servers/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ import (
config "github.com/spf13/viper"
)

const (
httpReadTimeout = 10
httpWriteTimeout = 30
maxHeaderBytes = 1 << 13 // 8KB
)

// GDRest is the GlusterD Rest server
type GDRest struct {
Routes *mux.Router
Expand Down Expand Up @@ -50,7 +56,11 @@ func NewMuxed(m cmux.CMux) *GDRest {

rest := &GDRest{
Routes: mux.NewRouter(),
server: &http.Server{},
server: &http.Server{
ReadTimeout: httpReadTimeout * time.Second,
WriteTimeout: httpWriteTimeout * time.Second,
MaxHeaderBytes: maxHeaderBytes,
},
stopCh: make(chan struct{}),
}

Expand Down

0 comments on commit 199dcb8

Please sign in to comment.