Convert to extrasugar

This commit is contained in:
Tony Garnock-Jones 2013-06-10 18:04:15 -04:00
parent 8c4c95f1a6
commit 024b6b75cc
3 changed files with 343 additions and 328 deletions

View File

@ -38,14 +38,13 @@
(ground-vm (timer-driver) (ground-vm (timer-driver)
(tcp-driver) (tcp-driver)
(tcp-spy) (tcp-spy)
(spawn #:debug-name 'ssh-tcp-listener #:child listener))) (name-process 'ssh-tcp-listener (spawn listener))))
(define listener (define listener
(transition/no-state (transition/no-state
(endpoint #:subscriber (tcp-channel ? (tcp-listener 2322) ?) (observe-publishers (tcp-channel ? (tcp-listener 2322) ?)
#:observer (match-conversation r
#:conversation r (on-presence (session-vm r))))))
#:on-presence (session-vm r))))
;;--------------------------------------------------------------------------- ;;---------------------------------------------------------------------------
@ -67,24 +66,27 @@
(flush-output) (flush-output)
(void)) (void))
(list (list
(endpoint #:subscriber (wild) #:everything (observe-publishers/everything (wild)
#:role r (match-interest-type i
#:on-presence (dump 'arrived r) (match-conversation c
#:on-absence (dump 'departed r) (on-presence (dump 'arrived (role 'publisher c i)))
[message (dump 'message message)]) (on-absence (dump 'departed (role 'publisher c i)))
(endpoint #:publisher (wild) #:everything (on-message [message (dump 'message message)]))))
#:role r (observe-subscribers/everything (wild)
#:on-presence (dump 'arrived r) (match-interest-type i
#:on-absence (dump 'departed r) (match-conversation c
[message (dump 'message message)]))) (on-presence (dump 'arrived (role 'subscriber c i)))
(on-absence (dump 'departed (role 'subscriber c i)))
(on-message [message (dump 'feedback message)]))))))
(define-syntax-rule (wait-as my-orientation topic action ...) (define-syntax-rule (wait-as my-orientation topic action ...)
(endpoint my-orientation topic #:observer (let-fresh (endpoint-name)
#:let-name endpoint-name (build-endpoint endpoint-name
#:state state (role my-orientation topic 'observer)
#:on-presence (sequence-actions (transition state (match-state state
(on-presence (sequence-actions (transition state
(delete-endpoint endpoint-name) (delete-endpoint endpoint-name)
action ...)))) action ...)))))))
(define (session-vm new-conversation) (define (session-vm new-conversation)
(match-define (tcp-channel remote-addr local-addr _) new-conversation) (match-define (tcp-channel remote-addr local-addr _) new-conversation)
@ -98,9 +100,10 @@
(define (read-handshake-and-become-reader) (define (read-handshake-and-become-reader)
(transition 'handshake-is-stateless ;; but, crucially, the ssh-reader proper isn't! (transition 'handshake-is-stateless ;; but, crucially, the ssh-reader proper isn't!
(at-meta-level (at-meta-level
(endpoint #:subscriber (tcp-channel remote-addr local-addr ?) (name-endpoint 'socket-reader
#:name 'socket-reader (subscriber (tcp-channel remote-addr local-addr ?)
#:state state (match-state state
(on-message
[(tcp-channel _ _ (? eof-object?)) [(tcp-channel _ _ (? eof-object?))
(transition state (quit))] (transition state (quit))]
[(tcp-channel _ _ (? bytes? remote-identification)) [(tcp-channel _ _ (? bytes? remote-identification))
@ -112,26 +115,25 @@
(send-feedback (tcp-channel remote-addr local-addr (tcp-mode 'bytes)))) (send-feedback (tcp-channel remote-addr local-addr (tcp-mode 'bytes))))
;; Then initialise the reader, switching to packet-reading mode. ;; Then initialise the reader, switching to packet-reading mode.
(lambda (ignored-state) (ssh-reader new-conversation)) (lambda (ignored-state) (ssh-reader new-conversation))
;; Finally, spawn the remaining processes and issue the initial credit to the reader. ;; Finally, spawn the remaining processes and issue
(spawn #:debug-name 'ssh-writer ;; the initial credit to the reader.
#:child (ssh-writer new-conversation) (name-process 'ssh-writer
;; TODO: canary: #:exit-signal? #t ;; TODO: canary: #:exit-signal? #t
) (spawn (ssh-writer new-conversation)))
;; Wait for the reader and writer get started, then tell ;; Wait for the reader and writer get started, then tell
;; the reader we are ready for a single packet and spawn ;; the reader we are ready for a single packet and spawn
;; the session manager. ;; the session manager.
(wait-as #:subscriber (inbound-packet (wild) (wild) (wild) (wild)) (wait-as 'subscriber (inbound-packet (wild) (wild) (wild) (wild))
(wait-as #:publisher (outbound-packet (wild)) (wait-as 'publisher (outbound-packet (wild))
(send-message (inbound-credit 1)) (send-message (inbound-credit 1))
(spawn #:debug-name 'ssh-session (name-process 'ssh-session
#:pid session-pid (spawn #:pid session-pid
#:child (ssh-session session-pid ;; TODO: canary: #:exit-signal? #t
(ssh-session session-pid
local-identification local-identification
remote-identification remote-identification
repl-boot repl-boot
'server) 'server)))))))])))))))
;; TODO: canary: #:exit-signal? #t
)))))]))))
(define (exn->outbound-packet reason) (define (exn->outbound-packet reason)
(outbound-packet (ssh-msg-disconnect (exn:fail:contract:protocol-reason-code reason) (outbound-packet (ssh-msg-disconnect (exn:fail:contract:protocol-reason-code reason)
@ -151,13 +153,13 @@
(define interesting? (disconnect-message-required? reason)) (define interesting? (disconnect-message-required? reason))
(transition inert-exception-handler (transition inert-exception-handler
(when interesting? (send-message (exn->outbound-packet reason))) (when interesting? (send-message (exn->outbound-packet reason)))
(yield #:state state ;; gross (yield state ;; gross
(transition state (at-meta-level (quit #:reason (and interesting? reason))))))) (transition state (at-meta-level (quit #f (and interesting? reason)))))))
(define (inert-exception-handler reason) (define (inert-exception-handler reason)
inert-exception-handler) inert-exception-handler)
(nested-vm #:debug-name (list 'ssh-session-vm new-conversation) (spawn-vm #:debug-name (list 'ssh-session-vm new-conversation)
(event-relay 'ssh-event-relay) (event-relay 'ssh-event-relay)
(timer-relay 'ssh-timer-relay) (timer-relay 'ssh-timer-relay)
(spy 'SSH) (spy 'SSH)
@ -170,10 +172,9 @@
(send-feedback (tcp-channel remote-addr local-addr (tcp-mode 'lines))) (send-feedback (tcp-channel remote-addr local-addr (tcp-mode 'lines)))
(send-feedback (tcp-channel remote-addr local-addr (tcp-credit 1)))) (send-feedback (tcp-channel remote-addr local-addr (tcp-credit 1))))
(spawn #:debug-name 'ssh-reader (name-process 'ssh-reader
#:child (read-handshake-and-become-reader)
;; TODO: canary: #:exit-signal? #t ;; TODO: canary: #:exit-signal? #t
) (spawn (read-handshake-and-become-reader)))
;; TODO: canary: ;; TODO: canary:
;; (spawn #:child ;; (spawn #:child
@ -191,9 +192,9 @@
(event-relay 'app-event-relay) (event-relay 'app-event-relay)
(spy 'APP) (spy 'APP)
(at-meta-level (at-meta-level
(endpoint #:subscriber (channel-message (channel-stream-name #t (wild)) (wild)) (subscriber (channel-message (channel-stream-name #t (wild)) (wild))
#:conversation (channel-message (channel-stream-name _ cname) _) (match-conversation (channel-message (channel-stream-name _ cname) _)
#:on-presence (spawn #:debug-name cname #:child (repl-instance user-name cname)))))) (on-presence (name-process cname (spawn (repl-instance user-name cname)))))))))
;; (repl-instance InputPort OutputPort InputPort OutputPort) ;; (repl-instance InputPort OutputPort InputPort OutputPort)
(struct repl-instance-state (c2s-in ;; used by thread to read input from relay (struct repl-instance-state (c2s-in ;; used by thread to read input from relay
@ -226,16 +227,17 @@
(define repl-thread (thread (lambda () (repl-shell user-name c2s-in s2c-out)))) (define repl-thread (thread (lambda () (repl-shell user-name c2s-in s2c-out))))
(transition state (transition state
(ch-do send-feedback inbound-stream (channel-stream-ok)) (ch-do send-feedback inbound-stream (channel-stream-ok))
(endpoint #:subscriber (cons (thread-dead-evt repl-thread) (wild)) (subscriber (cons (thread-dead-evt repl-thread) (wild))
[_ (quit #:reason "REPL thread exited")]) (on-message [_ (quit #f "REPL thread exited")]))
(endpoint #:subscriber (cons (peek-bytes-avail!-evt dummy-buffer 0 #f s2c-in) (wild)) (subscriber (cons (peek-bytes-avail!-evt dummy-buffer 0 #f s2c-in) (wild))
;; We're using peek-bytes-avail!-evt rather than ;; We're using peek-bytes-avail!-evt rather than
;; read-bytes-avail!-evt because of potential overwriting ;; read-bytes-avail!-evt because of potential overwriting
;; of the buffer. The overwriting can happen when there's ;; of the buffer. The overwriting can happen when there's
;; any latency between handling the event and the next ;; any latency between handling the event and the next
;; firing of the event, since the peek-bytes-avail!-evt ;; firing of the event, since the peek-bytes-avail!-evt
;; will overwrite its buffer next time it's synced on. ;; will overwrite its buffer next time it's synced on.
#:state state (match-state state
(on-message
[(cons _ (? eof-object?)) [(cons _ (? eof-object?))
(let () (let ()
(match-define (repl-instance-state c2s-in c2s-out s2c-in s2c-out) state) (match-define (repl-instance-state c2s-in c2s-out s2c-in s2c-out) state)
@ -247,7 +249,7 @@
[(cons _ (? number? count)) [(cons _ (? number? count))
(transition state (transition state
(ch-do send-message outbound-stream (channel-stream-data (ch-do send-message outbound-stream (channel-stream-data
(read-bytes count s2c-in))))]))] (read-bytes count s2c-in))))]))))]
[(or (channel-stream-data #"\4") ;; C-d a.k.a EOT [(or (channel-stream-data #"\4") ;; C-d a.k.a EOT
(channel-stream-eof)) (channel-stream-eof))
(let () (let ()
@ -269,21 +271,21 @@
(define-values (s2c-in s2c-out) (make-pipe)) (define-values (s2c-in s2c-out) (make-pipe))
(transition (repl-instance-state c2s-in c2s-out s2c-in s2c-out) (transition (repl-instance-state c2s-in c2s-out s2c-in s2c-out)
(at-meta-level (at-meta-level
(endpoint #:subscriber (channel-message inbound-stream (wild)) (subscriber (channel-message inbound-stream (wild))
#:state state (match-state state
#:on-presence (transition state (on-presence (transition state
(ch-do send-feedback inbound-stream (channel-stream-config (ch-do send-feedback inbound-stream (channel-stream-config
(default-packet-limit) (default-packet-limit)
#"")) #""))
(ch-do send-feedback inbound-stream (channel-stream-credit 1024))) (ch-do send-feedback inbound-stream (channel-stream-credit 1024))))
(on-message
[(channel-message _ body) [(channel-message _ body)
(handle-channel-message state body)])) (handle-channel-message state body)]))))
(at-meta-level (at-meta-level
(endpoint #:publisher (channel-message outbound-stream (wild)) (publisher (channel-message outbound-stream (wild))
[m (on-message [m (begin
(begin
(write `(channel outbound ,cname ,m)) (newline) (write `(channel outbound ,cname ,m)) (newline)
(void))])))] (void))]))))]
[type [type
(transition/no-state (transition/no-state
(at-meta-level (send-message (at-meta-level (send-message

View File

@ -514,7 +514,7 @@
(lambda (conn) (lambda (conn)
(transition conn (transition conn
;; TODO: canary for NESTED VM!: #:exit-signal? #t ;; TODO: canary for NESTED VM!: #:exit-signal? #t
(nested-vm #:debug-name 'ssh-application-vm (spawn-vm #:debug-name 'ssh-application-vm
((connection-application-boot conn) user-name)))))] ((connection-application-boot conn) user-name)))))]
[else [else
(transition conn (transition conn
@ -625,12 +625,13 @@
(define (! conn message) (define (! conn message)
(transition conn (send-message (outbound-packet message)))) (transition conn (send-message (outbound-packet message))))
(list (list
(endpoint #:subscriber (channel-message outbound-stream-name (wild)) (name-endpoint (list cname 'outbound)
#:name (list cname 'outbound) (subscriber (channel-message outbound-stream-name (wild))
#:state conn (match-state conn
#:on-presence (transition conn (on-presence (transition conn
(initial-message-producer inbound-stream-name outbound-stream-name)) (initial-message-producer inbound-stream-name outbound-stream-name)))
#:on-absence (maybe-close-channel cname conn 'local) (on-absence (maybe-close-channel cname conn 'local))
(on-message
[(channel-message _ body) [(channel-message _ body)
(let () (let ()
(define ch (findf (ssh-channel-name=? cname) (connection-channels conn))) (define ch (findf (ssh-channel-name=? cname) (connection-channels conn)))
@ -649,10 +650,11 @@
(! conn (ssh-msg-channel-request remote-ref type #t data-bytes))] (! conn (ssh-msg-channel-request remote-ref type #t data-bytes))]
[(channel-stream-open-failure reason description) [(channel-stream-open-failure reason description)
(! (discard-channel cname conn) (! (discard-channel cname conn)
(ssh-msg-channel-open-failure remote-ref reason description #""))]))]) (ssh-msg-channel-open-failure remote-ref reason description #""))]))]))))
(endpoint #:publisher (channel-message inbound-stream-name (wild)) (name-endpoint (list cname 'inbound)
#:name (list cname 'inbound) (publisher (channel-message inbound-stream-name (wild))
#:state conn (match-state conn
(on-message
[(channel-message _ body) [(channel-message _ body)
(let () (let ()
(define ch (findf (ssh-channel-name=? cname) (connection-channels conn))) (define ch (findf (ssh-channel-name=? cname) (connection-channels conn)))
@ -677,7 +679,7 @@
[(channel-stream-ok) [(channel-stream-ok)
(! conn (ssh-msg-channel-success remote-ref))] (! conn (ssh-msg-channel-success remote-ref))]
[(channel-stream-fail) [(channel-stream-fail)
(! conn (ssh-msg-channel-failure remote-ref))]))]))) (! conn (ssh-msg-channel-failure remote-ref))]))]))))))
(define (channel-notify conn ch inbound? body) (define (channel-notify conn ch inbound? body)
(transition conn (transition conn
@ -717,16 +719,14 @@
;; application. We are responding to channels appearing from the ;; application. We are responding to channels appearing from the
;; remote peer by virtue of our installation of the handler for ;; remote peer by virtue of our installation of the handler for
;; SSH_MSG_CHANNEL_OPEN above. ;; SSH_MSG_CHANNEL_OPEN above.
(endpoint #:publisher (channel-message (channel-stream-name ? (channel-name #t ? ?)) ?) (observe-subscribers (channel-message (channel-stream-name ? (channel-name #t ? ?)) ?)
#:observer (match-state conn
#:state conn (match-conversation (channel-message (channel-stream-name #t cname) _)
#:conversation (channel-message (channel-stream-name #t cname) _) (on-presence (respond-to-opened-outbound-channel conn cname)))))
#:on-presence (respond-to-opened-outbound-channel conn cname)) (observe-publishers (channel-message (channel-stream-name ? (channel-name #t ? ?)) ?)
(endpoint #:subscriber (channel-message (channel-stream-name ? (channel-name #t ? ?)) ?) (match-state conn
#:observer (match-conversation (channel-message (channel-stream-name #f cname) _)
#:state conn (on-presence (respond-to-opened-outbound-channel conn cname)))))))
#:conversation (channel-message (channel-stream-name #f cname) _)
#:on-presence (respond-to-opened-outbound-channel conn cname))))
(define (handle-msg-channel-open packet message conn) (define (handle-msg-channel-open packet message conn)
(match-define (ssh-msg-channel-open channel-type* (match-define (ssh-msg-channel-open channel-type*
@ -895,21 +895,22 @@
#f #f
application-boot) application-boot)
(endpoint #:subscriber (timer-expired 'rekey-timer (wild)) (subscriber (timer-expired 'rekey-timer (wild))
#:state conn (match-state conn
[(timer-expired 'rekey-timer now) (on-message [(timer-expired 'rekey-timer now)
(sequence-actions (transition conn) (sequence-actions (transition conn)
maybe-rekey)]) maybe-rekey)])))
(endpoint #:subscriber (outbound-byte-credit (wild)) (subscriber (outbound-byte-credit (wild))
#:state conn (match-state conn
[(outbound-byte-credit amount) (on-message [(outbound-byte-credit amount)
(sequence-actions (transition conn) (sequence-actions (transition conn)
(bump-total amount) (bump-total amount)
maybe-rekey)]) maybe-rekey)])))
(endpoint #:subscriber (inbound-packet (wild) (wild) (wild) (wild)) (subscriber (inbound-packet (wild) (wild) (wild) (wild))
#:state conn (match-state conn
(on-message
[(inbound-packet sequence-number payload message transfer-size) [(inbound-packet sequence-number payload message transfer-size)
(sequence-actions (transition conn) (sequence-actions (transition conn)
(lambda (conn) (lambda (conn)
@ -919,4 +920,4 @@
(dispatch-packet sequence-number payload message conn))) (dispatch-packet sequence-number payload message conn)))
(bump-total transfer-size) (bump-total transfer-size)
(send-message (inbound-credit 1)) (send-message (inbound-credit 1))
maybe-rekey)]))) maybe-rekey)])))))

View File

@ -310,9 +310,9 @@
(transition (ssh-reader-state 'packet-header initial-crypto-configuration 0 0) (transition (ssh-reader-state 'packet-header initial-crypto-configuration 0 0)
(at-meta-level (at-meta-level
(endpoint #:subscriber (tcp-channel remote-addr local-addr ?) (name-endpoint 'socket-reader
#:name 'socket-reader (subscriber (tcp-channel remote-addr local-addr ?)
#:state (and state (match-state (and state
(ssh-reader-state mode (ssh-reader-state mode
(crypto-configuration cipher (crypto-configuration cipher
cipher-description cipher-description
@ -320,6 +320,7 @@
hmac-description) hmac-description)
sequence-number sequence-number
remaining-credit)) remaining-credit))
(on-message
[(tcp-channel _ _ (? eof-object?)) [(tcp-channel _ _ (? eof-object?))
(transition state (quit))] (transition state (quit))]
[(tcp-channel _ _ (? bytes? encrypted-packet)) [(tcp-channel _ _ (? bytes? encrypted-packet))
@ -355,7 +356,10 @@
(transition new-state (transition new-state
(issue-credit new-state) (issue-credit new-state)
(send-message (send-message
(inbound-packet sequence-number payload (ssh-message-decode payload) bytes-read)))) (inbound-packet sequence-number
payload
(ssh-message-decode payload)
bytes-read))))
(match mode (match mode
['packet-header ['packet-header
@ -381,7 +385,8 @@
[`(packet-body ,packet-length ,payload-length ,first-block) [`(packet-body ,packet-length ,payload-length ,first-block)
(define decrypted-packet (decryptor encrypted-packet)) (define decrypted-packet (decryptor encrypted-packet))
(check-hmac packet-length payload-length (bytes-append first-block decrypted-packet))] (check-hmac packet-length payload-length (bytes-append first-block
decrypted-packet))]
[`(packet-hmac ,computed-hmac-bytes [`(packet-hmac ,computed-hmac-bytes
,mac-byte-count ,mac-byte-count
@ -394,25 +399,28 @@
(disconnect-with-error/local-info `((expected-hmac ,computed-hmac-bytes) (disconnect-with-error/local-info `((expected-hmac ,computed-hmac-bytes)
(actual-hmac ,received-hmac-bytes)) (actual-hmac ,received-hmac-bytes))
SSH_DISCONNECT_MAC_ERROR SSH_DISCONNECT_MAC_ERROR
"Corrupt MAC"))]))])) "Corrupt MAC"))]))])))))
(endpoint #:subscriber (inbound-credit (wild)) (subscriber (inbound-credit (wild))
#:state state (match-state state
(on-message
[(inbound-credit amount) [(inbound-credit amount)
(let () (let ()
(define new-state (struct-copy ssh-reader-state state (define new-state (struct-copy ssh-reader-state state
[remaining-credit [remaining-credit
(+ amount (ssh-reader-state-remaining-credit state))])) (+ amount (ssh-reader-state-remaining-credit state))]))
(transition new-state (transition new-state
(issue-credit new-state)))]) (issue-credit new-state)))])))
(endpoint #:subscriber (new-keys (wild) (subscriber (new-keys (wild)
(wild) (wild)
(wild) (wild) (wild) (wild)
(wild) (wild) (wild) (wild)
(wild) (wild)) (wild) (wild))
#:state state (match-state state
(on-message
[(? new-keys? nk) [(? new-keys? nk)
(transition (struct-copy ssh-reader-state state [config (apply-negotiated-options nk #f)]))]) (transition (struct-copy ssh-reader-state state
(endpoint #:publisher (inbound-packet (wild) (wild) (wild) (wild))))) [config (apply-negotiated-options nk #f)]))])))
(publisher (inbound-packet (wild) (wild) (wild) (wild)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Encrypted Packet Output ;; Encrypted Packet Output
@ -423,14 +431,15 @@
(define (ssh-writer new-conversation) (define (ssh-writer new-conversation)
(match-define (tcp-channel remote-addr local-addr _) new-conversation) (match-define (tcp-channel remote-addr local-addr _) new-conversation)
(transition (ssh-writer-state initial-crypto-configuration 0) (transition (ssh-writer-state initial-crypto-configuration 0)
(endpoint #:publisher (outbound-byte-credit (wild))) (publisher (outbound-byte-credit (wild)))
(endpoint #:subscriber (outbound-packet (wild)) (subscriber (outbound-packet (wild))
#:state (and state (match-state (and state
(ssh-writer-state (crypto-configuration cipher (ssh-writer-state (crypto-configuration cipher
cipher-description cipher-description
hmac hmac
hmac-description) hmac-description)
sequence-number)) sequence-number))
(on-message
[(outbound-packet message) [(outbound-packet message)
(let () (let ()
(define pad-block-size (supported-cipher-block-size cipher-description)) (define pad-block-size (supported-cipher-block-size cipher-description))
@ -444,7 +453,8 @@
(define min-padded-length (+ unpadded-length 4)) (define min-padded-length (+ unpadded-length 4))
(define padded-length (round-up min-padded-length pad-block-size)) (define padded-length (round-up min-padded-length pad-block-size))
(define padding-length (- padded-length unpadded-length)) (define padding-length (- padded-length unpadded-length))
(define packet-length (- padded-length 4)) ;; the packet length does *not* include itself! (define packet-length (- padded-length 4))
;; ^^ the packet length does *not* include itself!
(define packet (bit-string->bytes (define packet (bit-string->bytes
(bit-string (packet-length :: integer bits 32) (bit-string (packet-length :: integer bits 32)
(padding-length :: integer bits 8) (padding-length :: integer bits 8)
@ -453,20 +463,22 @@
(define encrypted-packet (encryptor packet)) (define encrypted-packet (encryptor packet))
(define computed-hmac-bytes (apply-hmac hmac sequence-number packet)) (define computed-hmac-bytes (apply-hmac hmac sequence-number packet))
(define mac-byte-count (bytes-length computed-hmac-bytes)) (define mac-byte-count (bytes-length computed-hmac-bytes))
(transition (struct-copy ssh-writer-state state [sequence-number (+ sequence-number 1)]) (transition (struct-copy ssh-writer-state state
[sequence-number (+ sequence-number 1)])
(at-meta-level (at-meta-level
(send-message (tcp-channel local-addr remote-addr encrypted-packet))) (send-message (tcp-channel local-addr remote-addr encrypted-packet)))
(when (positive? mac-byte-count) (when (positive? mac-byte-count)
(at-meta-level (at-meta-level
(send-message (tcp-channel local-addr remote-addr computed-hmac-bytes)))) (send-message (tcp-channel local-addr remote-addr computed-hmac-bytes))))
(send-message (send-message
(outbound-byte-credit (+ (bytes-length encrypted-packet) mac-byte-count)))))]) (outbound-byte-credit (+ (bytes-length encrypted-packet) mac-byte-count)))))])))
(endpoint #:subscriber (new-keys (wild) (subscriber (new-keys (wild)
(wild) (wild)
(wild) (wild) (wild) (wild)
(wild) (wild) (wild) (wild)
(wild) (wild)) (wild) (wild))
#:state state (match-state state
(on-message
[(? new-keys? nk) [(? new-keys? nk)
(transition (transition
(struct-copy ssh-writer-state state [config (apply-negotiated-options nk #t)]))]))) (struct-copy ssh-writer-state state [config (apply-negotiated-options nk #t)]))])))))