Skip to content

Commit 6253a19

Browse files
authored
fix(common): streamline logging in commonTCP methods by removing redundant error handling
1 parent 844edaa commit 6253a19

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

internal/common.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -709,13 +709,10 @@ func (c *Common) commonTCPLoop() {
709709
}
710710

711711
c.logger.Debug("TCP launch signal: cid %v -> %v", id, c.tunnelTCPConn.RemoteAddr())
712-
c.logger.Debug("Starting exchange: %v <-> %v", remoteConn.LocalAddr(), targetConn.LocalAddr())
713712

714713
// 交换数据
715-
_, _, err := conn.DataExchange(remoteConn, targetConn, c.readTimeout)
716-
717-
// 交换完成
718-
c.logger.Debug("Exchange complete: %v", err)
714+
c.logger.Debug("Starting exchange: %v <-> %v", remoteConn.LocalAddr(), targetConn.LocalAddr())
715+
c.logger.Debug("Exchange complete: %v", conn.DataExchange(remoteConn, targetConn, c.readTimeout))
719716
}(targetConn)
720717
}
721718
}
@@ -981,10 +978,7 @@ func (c *Common) commonTCPOnce(signalURL *url.URL) {
981978

982979
// 交换数据
983980
c.logger.Debug("Starting exchange: %v <-> %v", remoteConn.LocalAddr(), targetConn.LocalAddr())
984-
_, _, err = conn.DataExchange(remoteConn, targetConn, c.readTimeout)
985-
986-
// 交换完成
987-
c.logger.Debug("Exchange complete: %v", err)
981+
c.logger.Debug("Exchange complete: %v", conn.DataExchange(remoteConn, targetConn, c.readTimeout))
988982
}
989983

990984
// commonUDPOnce 共用处理单个UDP请求
@@ -1257,10 +1251,7 @@ func (c *Common) singleTCPLoop() error {
12571251

12581252
// 交换数据
12591253
c.logger.Debug("Starting exchange: %v <-> %v", tunnelConn.LocalAddr(), targetConn.LocalAddr())
1260-
_, _, err = conn.DataExchange(tunnelConn, targetConn, c.readTimeout)
1261-
1262-
// 交换完成
1263-
c.logger.Debug("Exchange complete: %v", err)
1254+
c.logger.Debug("Exchange complete: %v", conn.DataExchange(tunnelConn, targetConn, c.readTimeout))
12641255
}(tunnelConn)
12651256
}
12661257
}

0 commit comments

Comments
 (0)