From 9b990adf96085d6294e26a7dc2d33d17452097da Mon Sep 17 00:00:00 2001 From: fatedier Date: Mon, 29 Jan 2018 23:51:46 +0800 Subject: [PATCH] frpc: add proxy status 'wait start' --- Makefile | 3 --- client/proxy_manager.go | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6d160351..63927f9b 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,3 @@ clean: rm -f ./bin/frpc rm -f ./bin/frps cd ./tests && ./clean_test.sh && cd - - -save: - godep save ./... diff --git a/client/proxy_manager.go b/client/proxy_manager.go index 6f1e32c9..9d81ee76 100644 --- a/client/proxy_manager.go +++ b/client/proxy_manager.go @@ -12,10 +12,11 @@ import ( ) const ( - ProxyStatusNew = "new" - ProxyStatusStartErr = "start error" - ProxyStatusRunning = "running" - ProxyStatusClosed = "closed" + ProxyStatusNew = "new" + ProxyStatusStartErr = "start error" + ProxyStatusWaitStart = "wait start" + ProxyStatusRunning = "running" + ProxyStatusClosed = "closed" ) type ProxyManager struct { @@ -89,6 +90,12 @@ func (pw *ProxyWrapper) GetStatus() *ProxyStatus { return ps } +func (pw *ProxyWrapper) WaitStart() { + pw.mu.Lock() + defer pw.mu.Unlock() + pw.Status = ProxyStatusWaitStart +} + func (pw *ProxyWrapper) Start(remoteAddr string, serverRespErr string) error { if pw.pxy != nil { pw.pxy.Close() @@ -226,6 +233,7 @@ func (pm *ProxyManager) CheckAndStartProxy(pxyStatus []string) { pm.Warn("[%s] proxy send NewProxy message error") return } + pxy.WaitStart() break } }