Browse Source

pool: fix panic caused by sending to closed channel, fix #237

fatedier 8 years ago
parent
commit
f9a0d891a1
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/models/server/server.go

+ 6 - 0
src/models/server/server.go

@@ -445,6 +445,12 @@ func (p *ProxyServer) getWorkConn() (workConn *conn.Conn, err error) {
 }
 
 func (p *ProxyServer) connectionPoolManager(closeCh <-chan struct{}) {
+	defer func() {
+		if r := recover(); r != nil {
+			log.Warn("ProxyName [%s], connectionPoolManager panic %v", p.Name, r)
+		}
+	}()
+
 	for {
 		// check if we need more work connections and send messages to frpc to get more
 		time.Sleep(time.Duration(2) * time.Second)