This commit is contained in:
zhouyuyan committed 2017-09-04 16:57:01 +08:00
1 parent 5e937601ce
commit 8af790ffba
5 files changed
+21 -6

No files matched your search

+7
View File
@@ -15,6 +15,7 @@ const (
)
type Config struct {
Worker int `json:"workerNum"`
Host string `json:"host"`
Port string `json:"port"`
Cluster RouteInfo `json:"cluster"`
@@ -57,6 +58,12 @@ func LoadConfig() (*Config, error) {
return nil, err
}
if config.Worker == 0 {
config.Worker = 1024
}
WorkNum = config.Worker
if config.Port != "" {
if config.Host == "" {
config.Host = "0.0.0.0"
+6 -4
View File
@@ -1,14 +1,16 @@
package broker
const (
WorkNum = 4096
)
// const (
// WorkNum = 4096
// )
var WorkNum int
type Dispatcher struct {
WorkerPool chan chan *Message
}
func init() {
func StartDispatcher() {
InitMessagePool()
dispatcher := NewDispatcher()
dispatcher.Run()