mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-30 02:58:10 -07:00
udp: Add UDP configuration, move tracker shutdown to the main package
This commit is contained in:
+8
-12
@@ -126,20 +126,20 @@ func Serve(cfg *config.Config, tkr *tracker.Tracker) {
|
||||
tracker: tkr,
|
||||
}
|
||||
|
||||
glog.V(0).Info("Starting on ", cfg.ListenAddr)
|
||||
if cfg.HttpListenLimit != 0 {
|
||||
glog.V(0).Info("Limiting connections to ", cfg.HttpListenLimit)
|
||||
glog.V(0).Info("Starting HTTP on ", cfg.HTTPListenAddr)
|
||||
if cfg.HTTPListenLimit != 0 {
|
||||
glog.V(0).Info("Limiting connections to ", cfg.HTTPListenLimit)
|
||||
}
|
||||
|
||||
grace := &graceful.Server{
|
||||
Timeout: cfg.RequestTimeout.Duration,
|
||||
Timeout: cfg.HTTPRequestTimeout.Duration,
|
||||
ConnState: srv.connState,
|
||||
ListenLimit: cfg.HttpListenLimit,
|
||||
ListenLimit: cfg.HTTPListenLimit,
|
||||
Server: &http.Server{
|
||||
Addr: cfg.ListenAddr,
|
||||
Addr: cfg.HTTPListenAddr,
|
||||
Handler: newRouter(srv),
|
||||
ReadTimeout: cfg.HttpReadTimeout.Duration,
|
||||
WriteTimeout: cfg.HttpWriteTimeout.Duration,
|
||||
ReadTimeout: cfg.HTTPReadTimeout.Duration,
|
||||
WriteTimeout: cfg.HTTPWriteTimeout.Duration,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -150,8 +150,4 @@ func Serve(cfg *config.Config, tkr *tracker.Tracker) {
|
||||
glog.Errorf("Failed to gracefully run HTTP server: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
if err := srv.tracker.Close(); err != nil {
|
||||
glog.Errorf("Failed to shutdown tracker cleanly: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user