mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
Merge branch 'master' of https://github.com/duanhf2012/origin
This commit is contained in:
@@ -1062,7 +1062,7 @@ func (slf *TestTcpService) OnRequest (clientid uint64,msg proto.Message){
|
||||
提交bug及特性: https://github.com/duanhf2012/origin/issues
|
||||
|
||||
[因服务器是由个人维护,如果这个项目对您有帮助,您可以点我进行捐赠,感谢!](http://www.cppblog.com/images/cppblog_com/API/21416/r_pay.jpg "Thanks!")
|
||||
|
||||

|
||||
特别感谢以下赞助网友:
|
||||
|
||||
```
|
||||
@@ -1071,4 +1071,5 @@ _
|
||||
死磕代码
|
||||
bp-li
|
||||
阿正
|
||||
大头
|
||||
```
|
||||
|
||||
@@ -477,3 +477,14 @@ func (cls *Cluster) GetGlobalCfg() interface{} {
|
||||
return cls.globalCfg
|
||||
}
|
||||
|
||||
func (cls *Cluster) GetNodeInfo(nodeId int) (NodeInfo,bool) {
|
||||
cls.locker.RLock()
|
||||
defer cls.locker.RUnlock()
|
||||
|
||||
nodeInfo,ok:= cls.mapRpc[nodeId]
|
||||
if ok == false || nodeInfo == nil {
|
||||
return NodeInfo{},false
|
||||
}
|
||||
|
||||
return nodeInfo.nodeInfo,true
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"runtime"
|
||||
|
||||
"github.com/duanhf2012/origin/log"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
const defaultMaxTaskChannelNum = 1000000
|
||||
@@ -21,6 +22,7 @@ type Concurrent struct {
|
||||
|
||||
tasks chan task
|
||||
cbChannel chan func(error)
|
||||
open int32
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -33,6 +35,10 @@ func (c *Concurrent) OpenConcurrentByNumCPU(cpuNumMul float32) {
|
||||
}
|
||||
|
||||
func (c *Concurrent) OpenConcurrent(minGoroutineNum int32, maxGoroutineNum int32, maxTaskChannelNum int) {
|
||||
if atomic.AddInt32(&c.open,1) > 1 {
|
||||
panic("repeated calls to OpenConcurrent are not allowed!")
|
||||
}
|
||||
|
||||
c.tasks = make(chan task, maxTaskChannelNum)
|
||||
c.cbChannel = make(chan func(error), maxTaskChannelNum)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user