From 3318f68b5c78483d6252dc0f8cf2f3c89af0f60f Mon Sep 17 00:00:00 2001 From: berlin2123 <68841407+berlin2123@users.noreply.github.com> Date: Sun, 29 May 2022 09:43:27 +0800 Subject: [PATCH] Update proxy.go --- server/proxy/proxy.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/proxy/proxy.go b/server/proxy/proxy.go index 60c29d41..5cdb673e 100644 --- a/server/proxy/proxy.go +++ b/server/proxy/proxy.go @@ -287,7 +287,7 @@ func HandleUserTCPConnection(pxy Proxy, userConn net.Conn, serverCfg config.Serv if cfg.UseCompression { local = frpIo.WithCompression(local) } - startime := time.Now().Unix() + startime := time.Now().UnixNano() / 1000000 // time in microseconds xl.Debug("join connections, workConn(l[%s] r[%s]) userConn(l[%s] r[%s])", workConn.LocalAddr().String(), workConn.RemoteAddr().String(), userConn.LocalAddr().String(), userConn.RemoteAddr().String()) @@ -298,11 +298,11 @@ func HandleUserTCPConnection(pxy Proxy, userConn net.Conn, serverCfg config.Serv metrics.Server.CloseConnection(name, proxyType) metrics.Server.AddTrafficIn(name, proxyType, inCount) metrics.Server.AddTrafficOut(name, proxyType, outCount) - endtime := time.Now().Unix() + endtime := time.Now().UnixNano() / 1000000 // time in microseconds connection_duration := endtime - startime - //xl.Debug("join connections closed, it remains [%d]seconds, workConn(l[%s] r[%s]) userConn(l[%s] r[%s])", connection_duration, + //xl.Debug("join connections closed, it remains [%d]ms, workConn(l[%s] r[%s]) userConn(l[%s] r[%s])", connection_duration, // workConn.LocalAddr().String(), workConn.RemoteAddr().String(), userConn.LocalAddr().String(), userConn.RemoteAddr().String() ) - xl.Info("connections closed, it remains [%d]seconds, [%s]", connection_duration, userConn.RemoteAddr().String() ) + xl.Info("connections closed, it remains [%d]ms, [%s]", connection_duration, userConn.RemoteAddr().String() ) } type Manager struct {