mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 05:07:36 +03:00
reduce calls to time.Now() calls in connection (#4191)
This commit is contained in:
parent
87ef8ec48d
commit
45922f76d6
1 changed files with 6 additions and 7 deletions
|
@ -629,7 +629,7 @@ runLoop:
|
||||||
sendQueueAvailable = s.sendQueue.Available()
|
sendQueueAvailable = s.sendQueue.Available()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := s.triggerSending(); err != nil {
|
if err := s.triggerSending(now); err != nil {
|
||||||
s.closeLocal(err)
|
s.closeLocal(err)
|
||||||
}
|
}
|
||||||
if s.sendQueue.WouldBlock() {
|
if s.sendQueue.WouldBlock() {
|
||||||
|
@ -1767,9 +1767,8 @@ func (s *connection) applyTransportParameters() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *connection) triggerSending() error {
|
func (s *connection) triggerSending(now time.Time) error {
|
||||||
s.pacingDeadline = time.Time{}
|
s.pacingDeadline = time.Time{}
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
sendMode := s.sentPacketHandler.SendMode(now)
|
sendMode := s.sentPacketHandler.SendMode(now)
|
||||||
//nolint:exhaustive // No need to handle pacing limited here.
|
//nolint:exhaustive // No need to handle pacing limited here.
|
||||||
|
@ -1801,7 +1800,7 @@ func (s *connection) triggerSending() error {
|
||||||
s.scheduleSending()
|
s.scheduleSending()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return s.triggerSending()
|
return s.triggerSending(now)
|
||||||
case ackhandler.SendPTOHandshake:
|
case ackhandler.SendPTOHandshake:
|
||||||
if err := s.sendProbePacket(protocol.EncryptionHandshake, now); err != nil {
|
if err := s.sendProbePacket(protocol.EncryptionHandshake, now); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1810,7 +1809,7 @@ func (s *connection) triggerSending() error {
|
||||||
s.scheduleSending()
|
s.scheduleSending()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return s.triggerSending()
|
return s.triggerSending(now)
|
||||||
case ackhandler.SendPTOAppData:
|
case ackhandler.SendPTOAppData:
|
||||||
if err := s.sendProbePacket(protocol.Encryption1RTT, now); err != nil {
|
if err := s.sendProbePacket(protocol.Encryption1RTT, now); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1819,7 +1818,7 @@ func (s *connection) triggerSending() error {
|
||||||
s.scheduleSending()
|
s.scheduleSending()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return s.triggerSending()
|
return s.triggerSending(now)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("BUG: invalid send mode %d", sendMode)
|
return fmt.Errorf("BUG: invalid send mode %d", sendMode)
|
||||||
}
|
}
|
||||||
|
@ -1988,7 +1987,7 @@ func (s *connection) maybeSendAckOnlyPacket(now time.Time) error {
|
||||||
if packet == nil {
|
if packet == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return s.sendPackedCoalescedPacket(packet, ecn, time.Now())
|
return s.sendPackedCoalescedPacket(packet, ecn, now)
|
||||||
}
|
}
|
||||||
|
|
||||||
ecn := s.sentPacketHandler.ECNMode(true)
|
ecn := s.sentPacketHandler.ECNMode(true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue