Timeout waiting for identification line

This commit is contained in:
Tony Garnock-Jones 2021-06-19 15:12:39 +02:00
parent 410c53ebda
commit 60af9eae09
2 changed files with 12 additions and 3 deletions

View File

@ -44,8 +44,10 @@
(define local-identification #"SSH-2.0-RacketSSH_0.0")
(spawn #:name 'reader (ssh-reader conn-ds source))
(spawn #:name 'writer (ssh-writer conn-ds sink local-identification))
(spawn/link #:name 'reader (ssh-reader conn-ds ground-ds source))
(spawn/link #:name 'writer (ssh-writer conn-ds sink local-identification))
(on-stop (stop-actor-system))
(at conn-ds
(once

View File

@ -15,6 +15,7 @@
ssh-writer)
(require bitsyntax)
(require syndicate/drivers/timer)
(require syndicate/drivers/tcp)
(require "crypto.rkt")
@ -260,7 +261,7 @@
;; Encrypted Packet Input
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (ssh-reader conn-ds source)
(define (ssh-reader conn-ds ground-ds source)
(define input-handler #f)
(define (update-input-handler #:on-data proc) (set! input-handler proc))
(make-sink #:initial-source source
@ -271,7 +272,13 @@
(update-input-handler
#:on-data (lambda (remote-identification _mode)
(send! conn-ds (ssh-identification-line remote-identification))
(stop-facet identification-line-timeout-facet)
(update-input-handler #:on-data handle-packet-header)))
(define identification-line-timeout-facet
(at ground-ds
(once [(timeout 10000)
(log-info "Timeout waiting for remote-identification")
(stop-current-facet)])))
(define packet-size-limit (default-packet-limit))
(define sequence-number 0)