1
This commit is contained in:
parent
17c149e8bf
commit
ad45f61cb0
@ -1,5 +1,7 @@
|
||||
[
|
||||
{
|
||||
"listen_port": 8888
|
||||
"instance_id": 1,
|
||||
"listen_port": 8888,
|
||||
"http_listen_port": 8889
|
||||
}
|
||||
]
|
||||
|
@ -22,9 +22,11 @@ func (this *App) Init() {
|
||||
handlerMgr.init()
|
||||
playerMgr.init()
|
||||
wspListener.init()
|
||||
httpListener.init()
|
||||
}
|
||||
|
||||
func (this *App) UnInit() {
|
||||
httpListener.unInit()
|
||||
playerMgr.unInit()
|
||||
handlerMgr.unInit()
|
||||
wspListener.unInit()
|
||||
|
@ -4,3 +4,4 @@ var app = new (App)
|
||||
var wspListener = new (WSPListener)
|
||||
var playerMgr = new (PlayerMgr)
|
||||
var handlerMgr = new (HandlerMgr)
|
||||
var httpListener = new (HttpListener)
|
||||
|
19
server/imserver/httplistener.go
Normal file
19
server/imserver/httplistener.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mt"
|
||||
)
|
||||
|
||||
type HttpListener struct {
|
||||
httpServer *f5.HttpServer
|
||||
}
|
||||
|
||||
func (this *HttpListener) init() {
|
||||
this.httpServer = new (f5.HttpServer)
|
||||
this.httpServer.Init("imserver.httplistener", 1000 * 10)
|
||||
this.httpServer.Start(mt.Table.IMCluster.GetHttpListenPort())
|
||||
}
|
||||
|
||||
func (this *HttpListener) unInit() {
|
||||
}
|
@ -21,6 +21,10 @@ func (this *IMClusterTable) GetListenPort() int32 {
|
||||
return this.selfConf.GetListenPort()
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
type IMCluster struct {
|
||||
instance_id int32
|
||||
listen_port int32
|
||||
http_listen_port int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
@ -37,6 +38,14 @@ func (this *IMCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetHttpListenPort() int32 {
|
||||
return this.http_listen_port
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasHttpListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *MasterCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
@ -65,6 +74,7 @@ func (this *MasterCluster) HasListenPort() bool {
|
||||
func (this *IMCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *MasterCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
|
@ -6,6 +6,7 @@ message IMCluster
|
||||
{
|
||||
optional int32 instance_id = 1;
|
||||
optional int32 listen_port = 2;
|
||||
optional int32 http_listen_port = 3;
|
||||
}
|
||||
|
||||
message MasterCluster
|
||||
|
Loading…
x
Reference in New Issue
Block a user