Arm rekey timer.

This commit is contained in:
Tony Garnock-Jones 2012-06-12 12:13:40 -04:00
parent 78a0721051
commit fd08fb0b74
1 changed files with 11 additions and 12 deletions

View File

@ -223,10 +223,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (rekey-in-seconds-or-bytes delta-seconds delta-bytes total-transferred)
;; (transition conn
;; (send-message (set-timer 'rekey-timer
;; (* (rekey-wait-deadline rekey) 1000)
;; 'absolute)))]
(rekey-wait (+ (current-seconds) delta-seconds)
(+ total-transferred delta-bytes)))
@ -442,14 +438,14 @@
(lambda (newkeys-packet newkeys-message conn)
;; First, send our SSH_MSG_NEWKEYS,
;; incrementing the various counters, and then
;; apply the new algorithms.
;; apply the new algorithms. Also arm our rekey
;; timer.
(define new-rekey-state (rekey-in-seconds-or-bytes
(rekey-interval)
(rekey-volume)
(connection-total-transferred conn)))
(transition
(set-handlers (struct-copy connection conn
[rekey-state
(rekey-in-seconds-or-bytes
(rekey-interval)
(rekey-volume)
(connection-total-transferred conn))])
(set-handlers (struct-copy connection conn [rekey-state new-rekey-state])
SSH_MSG_SERVICE_REQUEST handle-msg-service-request)
(send-message (outbound-packet (ssh-msg-newkeys)))
(send-message
@ -457,7 +453,10 @@
derive-key
c2s-enc s2c-enc
c2s-mac s2c-mac
c2s-zip s2c-zip))))))
c2s-zip s2c-zip))
(send-message (set-timer 'rekey-timer
(* (rekey-wait-deadline new-rekey-state) 1000)
'absolute))))))
(let ((t (if should-discard-first-kex-packet
(struct-copy connection (continue-after-discard conn) [discard-next-packet? #t])