Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f783e5c331 | ||
|
|
c39b1c794f | ||
|
|
2633d43897 | ||
|
|
88dca006c4 | ||
|
|
98feb26b79 | ||
|
|
ac6683e79d |
@@ -123,8 +123,8 @@ function build() {
|
|||||||
|
|
||||||
# libpcap
|
# libpcap
|
||||||
if [ "$OS" == "linux" ] && [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ]] && [ "$TAG" == "plus" ]; then
|
if [ "$OS" == "linux" ] && [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ]] && [ "$TAG" == "plus" ]; then
|
||||||
CGO_LDFLAGS="-L${SRCDIR}/libs/libpcap/${ARCH} -lpcap"
|
CGO_LDFLAGS="-L${SRCDIR}/libs/libpcap/${ARCH} -lpcap -L${SRCDIR}/libs/libbrotli/${ARCH} -lbrotlienc -lbrotlidec -lbrotlicommon"
|
||||||
CGO_CFLAGS="-I${SRCDIR}/libs/libpcap/src/libpcap -I${SRCDIR}/libs/libpcap/src/libpcap/pcap"
|
CGO_CFLAGS="-I${SRCDIR}/libs/libpcap/src/libpcap -I${SRCDIR}/libs/libpcap/src/libpcap/pcap -I${SRCDIR}/libs/libbrotli/src/brotli/c/include"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z $CC_PATH ]; then
|
if [ ! -z $CC_PATH ]; then
|
||||||
|
|||||||
@@ -133,7 +133,10 @@ func (this *FileListHashMap) Clean() {
|
|||||||
this.lockers[i].Lock()
|
this.lockers[i].Lock()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.m = make([]map[uint64]zero.Zero, HashMapSharding)
|
// 这里不能简单清空 this.m ,避免导致别的数据无法写入 map 而产生 panic
|
||||||
|
for i := 0; i < HashMapSharding; i++ {
|
||||||
|
this.m[i] = map[uint64]zero.Zero{}
|
||||||
|
}
|
||||||
|
|
||||||
for i := HashMapSharding - 1; i >= 0; i-- {
|
for i := HashMapSharding - 1; i >= 0; i-- {
|
||||||
this.lockers[i].Unlock()
|
this.lockers[i].Unlock()
|
||||||
|
|||||||
@@ -125,6 +125,13 @@ func TestFileListHashMap_Delete(t *testing.T) {
|
|||||||
a.IsTrue(m.Len() == 0)
|
a.IsTrue(m.Len() == 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFileListHashMap_Clean(t *testing.T) {
|
||||||
|
var m = caches.NewFileListHashMap()
|
||||||
|
m.SetIsAvailable(true)
|
||||||
|
m.Clean()
|
||||||
|
m.Add("a")
|
||||||
|
}
|
||||||
|
|
||||||
func Benchmark_BigInt(b *testing.B) {
|
func Benchmark_BigInt(b *testing.B) {
|
||||||
var hash = stringutil.Md5("123456")
|
var hash = stringutil.Md5("123456")
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
//go:build !plus || !linux
|
||||||
|
|
||||||
package compressions
|
package compressions
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
//go:build !plus || !linux
|
||||||
|
|
||||||
package compressions
|
package compressions
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ func newBrotliWriter(writer io.Writer, level int) (*BrotliWriter, error) {
|
|||||||
return &BrotliWriter{
|
return &BrotliWriter{
|
||||||
writer: brotli.NewWriterOptions(writer, brotli.WriterOptions{
|
writer: brotli.NewWriterOptions(writer, brotli.WriterOptions{
|
||||||
Quality: level,
|
Quality: level,
|
||||||
LGWin: 13, // TODO 在全局设置里可以设置此值
|
LGWin: 14, // TODO 在全局设置里可以设置此值
|
||||||
}),
|
}),
|
||||||
level: level,
|
level: level,
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package teaconst
|
package teaconst
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "1.3.0"
|
Version = "1.3.1"
|
||||||
|
|
||||||
ProductName = "Edge Node"
|
ProductName = "Edge Node"
|
||||||
ProcessName = "edge-node"
|
ProcessName = "edge-node"
|
||||||
|
|||||||
@@ -1039,7 +1039,7 @@ func (this *Node) reloadServer() {
|
|||||||
for serverId, serverConfig := range updatingServerMap {
|
for serverId, serverConfig := range updatingServerMap {
|
||||||
if serverConfig != nil {
|
if serverConfig != nil {
|
||||||
if countUpdatingServers < maxPrintServers {
|
if countUpdatingServers < maxPrintServers {
|
||||||
remotelogs.Debug("NODE", "load server '"+types.String(serverId)+"'")
|
remotelogs.Debug("NODE", "reload server '"+types.String(serverId)+"'")
|
||||||
}
|
}
|
||||||
newNodeConfig.AddServer(serverConfig)
|
newNodeConfig.AddServer(serverConfig)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
"google.golang.org/grpc/encoding/gzip"
|
"google.golang.org/grpc/encoding/gzip"
|
||||||
|
"google.golang.org/grpc/keepalive"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"net/url"
|
"net/url"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -240,12 +241,15 @@ func (this *RPCClient) init() error {
|
|||||||
grpc.MaxCallSendMsgSize(512<<20),
|
grpc.MaxCallSendMsgSize(512<<20),
|
||||||
grpc.UseCompressor(gzip.Name),
|
grpc.UseCompressor(gzip.Name),
|
||||||
)
|
)
|
||||||
|
var keepaliveParams = grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
|
Time: 30 * time.Second,
|
||||||
|
})
|
||||||
if u.Scheme == "http" {
|
if u.Scheme == "http" {
|
||||||
conn, err = grpc.Dial(u.Host, grpc.WithTransportCredentials(insecure.NewCredentials()), callOptions)
|
conn, err = grpc.Dial(u.Host, grpc.WithTransportCredentials(insecure.NewCredentials()), callOptions, keepaliveParams)
|
||||||
} else if u.Scheme == "https" {
|
} else if u.Scheme == "https" {
|
||||||
conn, err = grpc.Dial(u.Host, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
|
conn, err = grpc.Dial(u.Host, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
})), callOptions)
|
})), callOptions, keepaliveParams)
|
||||||
} else {
|
} else {
|
||||||
return errors.New("parse endpoint failed: invalid scheme '" + u.Scheme + "'")
|
return errors.New("parse endpoint failed: invalid scheme '" + u.Scheme + "'")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ func setMaxMemory(memoryGB int) {
|
|||||||
memoryGB = 1
|
memoryGB = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxMemoryBytes = (int64(memoryGB) << 30) * 75 / 100 // 默认 75%
|
var maxMemoryBytes = (int64(memoryGB) << 30) * 80 / 100 // 默认 80%
|
||||||
debug.SetMemoryLimit(maxMemoryBytes)
|
debug.SetMemoryLimit(maxMemoryBytes)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user