Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions center/core/conn/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func (c *Center) connectToAgent(host *model.Host, resultCh chan<- error) {
}

// 记录连接
agentID := conn.RemoteAddr().String()
agentID := fmt.Sprintf("%s:%d", host.AgentAddr, host.AgentPort)
c.mu.Lock()
c.agentConns[agentID] = conn
c.mu.Unlock()
Expand Down Expand Up @@ -633,7 +633,7 @@ func (c *Center) connectToAgent(host *model.Host, resultCh chan<- error) {
}

func (c *Center) handleConnection(host *model.Host, conn net.Conn) {
agentID := conn.RemoteAddr().String()
agentID := fmt.Sprintf("%s:%d", host.AgentAddr, host.AgentPort)

defer func() {
// 在defer中关闭连接并从agentConns中删除
Expand Down