mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-19 02:44:42 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be3daf19f9 | ||
|
|
aa91c7bf1b | ||
|
|
7fe73e55fb | ||
|
|
e5ceaa9e76 | ||
|
|
97c55ada71 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@
|
|||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
*.out
|
*.out
|
||||||
|
.DS_Store
|
||||||
|
|||||||
@@ -244,15 +244,6 @@ func (cls *Cluster) GetNodeIdByService(serviceName string, rpcClientList []*rpc.
|
|||||||
return nil, count
|
return nil, count
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cls *Cluster) getServiceCfg(serviceName string) interface{} {
|
|
||||||
v, ok := cls.localServiceCfg[serviceName]
|
|
||||||
if ok == false {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cls *Cluster) GetServiceCfg(serviceName string) interface{} {
|
func (cls *Cluster) GetServiceCfg(serviceName string) interface{} {
|
||||||
serviceCfg, ok := cls.localServiceCfg[serviceName]
|
serviceCfg, ok := cls.localServiceCfg[serviceName]
|
||||||
if ok == false {
|
if ok == false {
|
||||||
|
|||||||
@@ -2,14 +2,16 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/duanhf2012/origin/event"
|
"github.com/duanhf2012/origin/event"
|
||||||
"github.com/duanhf2012/origin/log"
|
"github.com/duanhf2012/origin/log"
|
||||||
rpcHandle "github.com/duanhf2012/origin/rpc"
|
rpcHandle "github.com/duanhf2012/origin/rpc"
|
||||||
"github.com/duanhf2012/origin/util/timer"
|
"github.com/duanhf2012/origin/util/timer"
|
||||||
"reflect"
|
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const InitModuleId = 1e9
|
const InitModuleId = 1e9
|
||||||
|
|
||||||
type IModule interface {
|
type IModule interface {
|
||||||
@@ -123,8 +125,8 @@ func (m *Module) ReleaseModule(moduleId uint32){
|
|||||||
m.ReleaseModule(id)
|
m.ReleaseModule(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pModule.GetEventHandler().Destroy()
|
|
||||||
pModule.self.OnRelease()
|
pModule.self.OnRelease()
|
||||||
|
pModule.GetEventHandler().Destroy()
|
||||||
log.SDebug("Release module ", pModule.GetModuleName())
|
log.SDebug("Release module ", pModule.GetModuleName())
|
||||||
for pTimer := range pModule.mapActiveTimer {
|
for pTimer := range pModule.mapActiveTimer {
|
||||||
pTimer.Cancel()
|
pTimer.Cancel()
|
||||||
@@ -155,6 +157,7 @@ func (m *Module) NewModuleId() uint32{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var timerSeedId uint32
|
var timerSeedId uint32
|
||||||
|
|
||||||
func (m *Module) GenTimerId() uint64 {
|
func (m *Module) GenTimerId() uint64 {
|
||||||
for {
|
for {
|
||||||
newTimerId := (uint64(m.GetModuleId()) << 32) | uint64(atomic.AddUint32(&timerSeedId, 1))
|
newTimerId := (uint64(m.GetModuleId()) << 32) | uint64(atomic.AddUint32(&timerSeedId, 1))
|
||||||
@@ -166,7 +169,6 @@ func (m *Module) GenTimerId() uint64{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m *Module) GetAncestor() IModule {
|
func (m *Module) GetAncestor() IModule {
|
||||||
return m.ancestor
|
return m.ancestor
|
||||||
}
|
}
|
||||||
@@ -287,8 +289,6 @@ func (m *Module) CancelTimerId(timerId *uint64) bool{
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func (m *Module) OnRelease() {
|
func (m *Module) OnRelease() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ func (tcpService *TcpService) genId() uint64 {
|
|||||||
|
|
||||||
|
|
||||||
func GetNodeId(agentId uint64) int {
|
func GetNodeId(agentId uint64) int {
|
||||||
return int(agentId>>54)
|
return int(agentId>>50)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tcpService *TcpService) OnInit() error{
|
func (tcpService *TcpService) OnInit() error{
|
||||||
|
|||||||
Reference in New Issue
Block a user