mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-07 00:42:22 +07:00
optimize: only print routing log for new connection to avoid the log exploded (Quic and BT).
This commit is contained in:
@ -212,6 +212,8 @@ getNew:
|
|||||||
// This is real dialer.
|
// This is real dialer.
|
||||||
d := ue.Dialer
|
d := ue.Dialer
|
||||||
|
|
||||||
|
if isNew {
|
||||||
|
// Only print routing for new connection to avoid the log exploded (Quic and BT).
|
||||||
if isDns && c.log.IsLevelEnabled(logrus.DebugLevel) && len(dnsMessage.Questions) > 0 {
|
if isDns && c.log.IsLevelEnabled(logrus.DebugLevel) && len(dnsMessage.Questions) > 0 {
|
||||||
q := dnsMessage.Questions[0]
|
q := dnsMessage.Questions[0]
|
||||||
c.log.WithFields(logrus.Fields{
|
c.log.WithFields(logrus.Fields{
|
||||||
@ -233,6 +235,7 @@ getNew:
|
|||||||
RefineSourceToShow(src, destToSend.Addr()), RefineAddrPortToShow(destToSend),
|
RefineSourceToShow(src, destToSend.Addr()), RefineAddrPortToShow(destToSend),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//log.Printf("WriteToUDPAddrPort->%v", destToSend)
|
//log.Printf("WriteToUDPAddrPort->%v", destToSend)
|
||||||
_, err = ue.WriteToUDPAddrPort(data, destToSend)
|
_, err = ue.WriteToUDPAddrPort(data, destToSend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -98,6 +98,7 @@ func (p *UdpEndpointPool) Remove(lAddr netip.AddrPort, udpEndpoint *UdpEndpoint)
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *UdpEndpointPool) GetOrCreate(lAddr netip.AddrPort, createOption *UdpEndpointOptions) (udpEndpoint *UdpEndpoint, isNew bool, err error) {
|
func (p *UdpEndpointPool) GetOrCreate(lAddr netip.AddrPort, createOption *UdpEndpointOptions) (udpEndpoint *UdpEndpoint, isNew bool, err error) {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
|
Reference in New Issue
Block a user