v6.1
This commit is contained in:
@ -9,7 +9,7 @@ v6.1
|
|||||||
TOU提供了TCP over UDP,多种自定义加密UDP方式传输TCP数据.
|
TOU提供了TCP over UDP,多种自定义加密UDP方式传输TCP数据.
|
||||||
5.优化了DST,防止意外crash.
|
5.优化了DST,防止意外crash.
|
||||||
6.修复了mapx的Keys()方法的bug导致内网穿透bridge不稳定的问题.
|
6.修复了mapx的Keys()方法的bug导致内网穿透bridge不稳定的问题.
|
||||||
|
7.修复了部分服务不能绑定IPv6地址的bug.
|
||||||
|
|
||||||
v6.0 企业版开源啦
|
v6.0 企业版开源啦
|
||||||
本次更新主要是把企业版开源,把企业版代码合并到现在的开源goproxy当中,继续遵循GPLv3,免费开源,
|
本次更新主要是把企业版开源,把企业版代码合并到现在的开源goproxy当中,继续遵循GPLv3,免费开源,
|
||||||
|
|||||||
@ -152,14 +152,7 @@ type Tuple struct {
|
|||||||
func (m ConcurrentMap) Iter() <-chan Tuple {
|
func (m ConcurrentMap) Iter() <-chan Tuple {
|
||||||
chans := snapshot(m)
|
chans := snapshot(m)
|
||||||
ch := make(chan Tuple)
|
ch := make(chan Tuple)
|
||||||
go func() {
|
go fanIn(chans, ch)
|
||||||
defer func() {
|
|
||||||
if e := recover(); e != nil {
|
|
||||||
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
fanIn(chans, ch)
|
|
||||||
}()
|
|
||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,14 +164,7 @@ func (m ConcurrentMap) IterBuffered() <-chan Tuple {
|
|||||||
total += cap(c)
|
total += cap(c)
|
||||||
}
|
}
|
||||||
ch := make(chan Tuple, total)
|
ch := make(chan Tuple, total)
|
||||||
go func() {
|
go fanIn(chans, ch)
|
||||||
defer func() {
|
|
||||||
if e := recover(); e != nil {
|
|
||||||
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
fanIn(chans, ch)
|
|
||||||
}()
|
|
||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,11 +179,6 @@ func snapshot(m ConcurrentMap) (chans []chan Tuple) {
|
|||||||
// Foreach shard.
|
// Foreach shard.
|
||||||
for index, shard := range m {
|
for index, shard := range m {
|
||||||
go func(index int, shard *ConcurrentMapShared) {
|
go func(index int, shard *ConcurrentMapShared) {
|
||||||
defer func() {
|
|
||||||
if e := recover(); e != nil {
|
|
||||||
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
// Foreach key, value pair.
|
// Foreach key, value pair.
|
||||||
shard.RLock()
|
shard.RLock()
|
||||||
chans[index] = make(chan Tuple, len(shard.items))
|
chans[index] = make(chan Tuple, len(shard.items))
|
||||||
@ -215,22 +196,25 @@ func snapshot(m ConcurrentMap) (chans []chan Tuple) {
|
|||||||
|
|
||||||
// fanIn reads elements from channels `chans` into channel `out`
|
// fanIn reads elements from channels `chans` into channel `out`
|
||||||
func fanIn(chans []chan Tuple, out chan Tuple) {
|
func fanIn(chans []chan Tuple, out chan Tuple) {
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
||||||
|
}
|
||||||
|
}()
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
wg.Add(len(chans))
|
wg.Add(len(chans))
|
||||||
for _, ch := range chans {
|
for _, ch := range chans {
|
||||||
go func() {
|
go func(ch chan Tuple) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if e := recover(); e != nil {
|
if e := recover(); e != nil {
|
||||||
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
func(ch chan Tuple) {
|
for t := range ch {
|
||||||
for t := range ch {
|
out <- t
|
||||||
out <- t
|
}
|
||||||
}
|
wg.Done()
|
||||||
wg.Done()
|
}(ch)
|
||||||
}(ch)
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
close(out)
|
close(out)
|
||||||
@ -281,22 +265,20 @@ func (m ConcurrentMap) Keys() []string {
|
|||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
wg.Add(SHARD_COUNT)
|
wg.Add(SHARD_COUNT)
|
||||||
for _, shard := range m {
|
for _, shard := range m {
|
||||||
go func() {
|
go func(shard *ConcurrentMapShared) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if e := recover(); e != nil {
|
if e := recover(); e != nil {
|
||||||
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
fmt.Printf("crashed, err: %s\nstack:%s", e, string(debug.Stack()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
func(shard *ConcurrentMapShared) {
|
// Foreach key, value pair.
|
||||||
// Foreach key, value pair.
|
shard.RLock()
|
||||||
shard.RLock()
|
for key := range shard.items {
|
||||||
for key := range shard.items {
|
ch <- key
|
||||||
ch <- key
|
}
|
||||||
}
|
shard.RUnlock()
|
||||||
shard.RUnlock()
|
wg.Done()
|
||||||
wg.Done()
|
}(shard)
|
||||||
}(shard)
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
close(ch)
|
close(ch)
|
||||||
|
|||||||
Reference in New Issue
Block a user