This commit is contained in:
arraykeys@gmail.com
2018-12-29 13:29:45 +08:00
parent 78143ce638
commit 83022d3efc
4 changed files with 23 additions and 8 deletions

View File

@ -1,9 +1,9 @@
proxy更新日志 proxy更新日志
v6.7 v6.8
1.HTTP(S)\SOCKS5代理,API认证功能,发送给认证接口的参数增加了本地IP,local_ip字段, 1.HTTP(S)\SOCKS5代理,API认证功能,发送给认证接口的参数增加了本地IP,local_ip字段,
代表用户访问的是本地服务器的哪个IP. 代表用户访问的是本地服务器的哪个IP.
2.fix #194 2.fix #194 , fix #134 , 代理更稳定.
3.fix #134 3.增加了一波英文文档.
v6.6 v6.6
1.优化了limitconn的关闭逻辑,释放更多资源. 1.优化了limitconn的关闭逻辑,释放更多资源.

View File

@ -1 +1 @@
6.7 6.8

View File

@ -1,3 +1,4 @@
v4.8 v6.8
1.修复了多个服务同时开启日志,只会输出到最后一个日志文件的bug. 1.sdk增加了调试锁,避免潜在的并发问题.
2.增加了获取sdk版本的Version()方法. 2.sdk的Stop方法增加了锁,避免潜在的并发问题.
3.sdk的Stop方法增加了关闭文件操作.

View File

@ -10,6 +10,7 @@ import (
"path/filepath" "path/filepath"
"runtime/pprof" "runtime/pprof"
"strings" "strings"
"sync"
"github.com/snail007/goproxy/core/lib/kcpcfg" "github.com/snail007/goproxy/core/lib/kcpcfg"
encryptconn "github.com/snail007/goproxy/core/lib/transport/encrypt" encryptconn "github.com/snail007/goproxy/core/lib/transport/encrypt"
@ -34,7 +35,9 @@ var (
app *kingpin.Application app *kingpin.Application
cpuProfilingFile, memProfilingFile, blockProfilingFile, cpuProfilingFile, memProfilingFile, blockProfilingFile,
goroutineProfilingFile, threadcreateProfilingFile *os.File goroutineProfilingFile, threadcreateProfilingFile *os.File
isProfiling bool isProfiling bool
profilingLock = &sync.Mutex{}
startStopLock = &sync.Mutex{}
) )
type LogCallback interface { type LogCallback interface {
@ -475,6 +478,8 @@ func StartWithLog(serviceID, serviceArgsStr string, loggerCallback LogCallback)
} }
func Stop(serviceID string) { func Stop(serviceID string) {
startStopLock.Lock()
defer startStopLock.Unlock()
services.Stop(serviceID) services.Stop(serviceID)
} }
@ -482,6 +487,8 @@ func Version() string {
return SDK_VERSION return SDK_VERSION
} }
func StartProfiling(storePath string) { func StartProfiling(storePath string) {
profilingLock.Lock()
defer profilingLock.Unlock()
if !isProfiling { if !isProfiling {
isProfiling = true isProfiling = true
if storePath == "" { if storePath == "" {
@ -496,6 +503,8 @@ func StartProfiling(storePath string) {
} }
} }
func StopProfiling() { func StopProfiling() {
profilingLock.Lock()
defer profilingLock.Unlock()
if isProfiling { if isProfiling {
isProfiling = false isProfiling = false
pprof.StopCPUProfile() pprof.StopCPUProfile()
@ -507,6 +516,11 @@ func StopProfiling() {
block.WriteTo(blockProfilingFile, 1) block.WriteTo(blockProfilingFile, 1)
threadcreate := pprof.Lookup("threadcreate") threadcreate := pprof.Lookup("threadcreate")
threadcreate.WriteTo(threadcreateProfilingFile, 1) threadcreate.WriteTo(threadcreateProfilingFile, 1)
//close
goroutineProfilingFile.Close()
memProfilingFile.Close()
blockProfilingFile.Close()
threadcreateProfilingFile.Close()
} }
} }