create the session timer at the beginning of the run loop

This commit is contained in:
Marten Seemann
2020-05-02 08:35:35 +07:00
parent 1db3f06e87
commit 286dcf555f

View File

@@ -472,7 +472,6 @@ func (s *session) preSetup() {
s.ctx, s.ctxCancel = context.WithCancel(context.Background())
s.handshakeCtx, s.handshakeCtxCancel = context.WithCancel(context.Background())
s.timer = utils.NewTimer()
now := time.Now()
s.lastPacketReceivedTime = now
s.sessionCreationTime = now
@@ -490,6 +489,8 @@ func (s *session) preSetup() {
func (s *session) run() error {
defer s.ctxCancel()
s.timer = utils.NewTimer()
go s.cryptoStreamHandler.RunHandshake()
go func() {
if err := s.sendQueue.Run(); err != nil {