Browse Source

add 30 seconds http read timeout

pull/2/head
Chris Lu 12 years ago
parent
commit
d2dd7d1694
  1. 8
      weed-fs/src/cmd/weed/master.go
  2. 7
      weed-fs/src/cmd/weed/volume.go

8
weed-fs/src/cmd/weed/master.go

@ -10,6 +10,7 @@ import (
"pkg/topology"
"strconv"
"strings"
"time"
)
func init() {
@ -140,7 +141,12 @@ func runMaster(cmd *Command, args []string) bool {
topo.StartRefreshWritableVolumes()
log.Println("Start Weed Master", VERSION, "at port", strconv.Itoa(*mport))
e := http.ListenAndServe(":"+strconv.Itoa(*mport), nil)
srv := &http.Server{
Addr:":"+strconv.Itoa(*mport),
Handler: http.DefaultServeMux,
ReadTimeout: 30*time.Second,
}
e := srv.ListenAndServe()
if e != nil {
log.Fatalf("Fail to start:%s", e.Error())
}

7
weed-fs/src/cmd/weed/volume.go

@ -273,7 +273,12 @@ func runVolume(cmd *Command, args []string) bool {
log.Println("store joined at", *masterNode)
log.Println("Start Weed volume server", VERSION, "at http://"+*ip+":"+strconv.Itoa(*vport))
e := http.ListenAndServe(":"+strconv.Itoa(*vport), nil)
srv := &http.Server{
Addr:":"+strconv.Itoa(*vport),
Handler: http.DefaultServeMux,
ReadTimeout: 30*time.Second,
}
e := srv.ListenAndServe()
if e != nil {
log.Fatalf("Fail to start:%s", e.Error())
}

Loading…
Cancel
Save