mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-03 08:23:04 +00:00
lazy evaluation of log fields
This commit is contained in:
1 parent
8f20933457
commit
eec0bb4db4
25 files changed
+124
-117
No files matched your search
@@ -17,7 +17,7 @@ type FreedomConnection struct {
|
||||
}
|
||||
|
||||
func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) error {
|
||||
log.Info("Freedom: Opening connection to %s", firstPacket.Destination().String())
|
||||
log.Info("Freedom: Opening connection to ", firstPacket.Destination())
|
||||
|
||||
var conn net.Conn
|
||||
err := retry.Timed(5, 100).On(func() error {
|
||||
@@ -30,7 +30,7 @@ func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.Outbou
|
||||
})
|
||||
if err != nil {
|
||||
close(ray.OutboundOutput())
|
||||
log.Error("Freedom: Failed to open connection: %s : %v", firstPacket.Destination().String(), err)
|
||||
log.Error("Freedom: Failed to open connection to ", firstPacket.Destination(), ": ", err)
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
@@ -60,7 +60,7 @@ func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.Outbou
|
||||
defer close(output)
|
||||
|
||||
response, err := v2net.ReadFrom(conn, nil)
|
||||
log.Info("Freedom receives %d bytes from %s", response.Len(), conn.RemoteAddr().String())
|
||||
log.Info("Freedom receives ", response.Len(), " bytes from ", conn.RemoteAddr())
|
||||
if response.Len() > 0 {
|
||||
output <- response
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user