刘河 6 years ago
parent
commit
48c7309973
2 changed files with 4 additions and 1 deletions
  1. 1 1
      bridge/bridge.go
  2. 3 0
      lib/conn/link.go

+ 1 - 1
bridge/bridge.go

@@ -309,7 +309,7 @@ func (s *Bridge) SendLinkInfo(clientId int, link *conn.Link, linkAddr string) (t
 		v.linkMap[link.Id] = link
 		v.Unlock()
 		if !s.waitStatus(clientId, link.Id) {
-			err = errors.New("connect fail")
+			err = errors.New(fmt.Sprintf("connect target %s fail", link.Host))
 			return
 		}
 	} else {

+ 3 - 0
lib/conn/link.go

@@ -54,6 +54,9 @@ func (s *Link) Run(flow bool) {
 					}
 					return
 				} else {
+					if s.Conn == nil {
+						return
+					}
 					if s.UdpListener != nil && s.UdpRemoteAddr != nil {
 						s.UdpListener.WriteToUDP(content, s.UdpRemoteAddr)
 					} else {