mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-23 02:33:22 +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
|
||||
*.out
|
||||
.DS_Store
|
||||
|
||||
@@ -244,15 +244,6 @@ func (cls *Cluster) GetNodeIdByService(serviceName string, rpcClientList []*rpc.
|
||||
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{} {
|
||||
serviceCfg, ok := cls.localServiceCfg[serviceName]
|
||||
if ok == false {
|
||||
|
||||
@@ -2,14 +2,16 @@ package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/duanhf2012/origin/event"
|
||||
"github.com/duanhf2012/origin/log"
|
||||
rpcHandle "github.com/duanhf2012/origin/rpc"
|
||||
"github.com/duanhf2012/origin/util/timer"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
const InitModuleId = 1e9
|
||||
|
||||
type IModule interface {
|
||||
@@ -123,8 +125,8 @@ func (m *Module) ReleaseModule(moduleId uint32){
|
||||
m.ReleaseModule(id)
|
||||
}
|
||||
|
||||
pModule.GetEventHandler().Destroy()
|
||||
pModule.self.OnRelease()
|
||||
pModule.GetEventHandler().Destroy()
|
||||
log.SDebug("Release module ", pModule.GetModuleName())
|
||||
for pTimer := range pModule.mapActiveTimer {
|
||||
pTimer.Cancel()
|
||||
@@ -155,6 +157,7 @@ func (m *Module) NewModuleId() uint32{
|
||||
}
|
||||
|
||||
var timerSeedId uint32
|
||||
|
||||
func (m *Module) GenTimerId() uint64 {
|
||||
for {
|
||||
newTimerId := (uint64(m.GetModuleId()) << 32) | uint64(atomic.AddUint32(&timerSeedId, 1))
|
||||
@@ -166,7 +169,6 @@ func (m *Module) GenTimerId() uint64{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func (m *Module) GetAncestor() IModule {
|
||||
return m.ancestor
|
||||
}
|
||||
@@ -287,8 +289,6 @@ func (m *Module) CancelTimerId(timerId *uint64) bool{
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
func (m *Module) OnRelease() {
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func (tcpService *TcpService) genId() uint64 {
|
||||
|
||||
|
||||
func GetNodeId(agentId uint64) int {
|
||||
return int(agentId>>54)
|
||||
return int(agentId>>50)
|
||||
}
|
||||
|
||||
func (tcpService *TcpService) OnInit() error{
|
||||
|
||||
Reference in New Issue
Block a user