MESSAGE_LIST_SIZE = 50 ) var ( all_channel *AllChannel // object pool post_message_pool *sync.Pool post_reply_pool *sync.Pool poll_message_pool *sync.Pool user_pool *sync.Pool user_spinlock_pool *sync.Pool user_message_buffer_pool *sync.Pool // byte pool: 8K []byte each of which can hold 8K of data byte_pool = bytepool.New(8192, 8192) ServerDebug bool ) type AllChannel struct { Lock *sync.RWMutex Channels map[string]*Channel } type Channel struct { Name string Users map[string]*User UsersLock []*sync.RWMutex MultiCastChan chan *PostMessage Count int64
USE_FASE_ONLINE_MAP = true CHANGE_USER_STATE_IN_REAL_TIME = true POLL_WAIT_TIME = 5 //MULTI_CAST_BUFFER_SIZE = 1 << 19 //CHANNEL_LOCKS = 8 //CHANNEL_SCAVENGER = 8 ) var ( all_channel *AllChannel // byte pool: 4K []byte each of which can hold 8K of data byte_pool = bytepool.New(4096, 8192) // timingwheel wheel_seconds = utils.NewTimingWheel(1*time.Second, 600) wheel_milliseconds = utils.NewTimingWheel(10*time.Millisecond, 2) ServerDebug bool Config *lib.GlobalConfig CHANNEL_LOCKS = int(runtime.NumCPU()) CHANNEL_SCAVENGER = int(runtime.NumCPU()) ) type AllChannel struct { RLock *sync.RWMutex