Don't advertise a statevector's existence to upper layers until it is somewhat established
This commit is contained in:
parent
03a6455594
commit
3130b307b5
47
tcp.rkt
47
tcp.rkt
|
@ -375,14 +375,20 @@
|
||||||
|
|
||||||
;; ConnState -> Gestalt
|
;; ConnState -> Gestalt
|
||||||
(define (compute-gestalt s)
|
(define (compute-gestalt s)
|
||||||
|
(define worldward-facing-gestalt
|
||||||
|
(gestalt-union (sub (tcp-packet #t src-ip src-port dst-ip dst-port ? ? ? ? ? ?))
|
||||||
|
(pub (tcp-packet #f dst-ip dst-port src-ip src-port ? ? ? ? ? ?))))
|
||||||
|
(define appward-facing-gestalt
|
||||||
|
(if (conn-state-syn-acked? s)
|
||||||
|
(gestalt-union (if (not (buffer-finished? (conn-state-inbound s)))
|
||||||
|
(pub (tcp-channel src dst ?))
|
||||||
|
(gestalt-empty))
|
||||||
|
(sub (tcp-channel dst src ?))
|
||||||
|
(pub (tcp-channel src dst ?) #:level 1))
|
||||||
|
(gestalt-empty)))
|
||||||
(gestalt-union (sub (timer-expired (timer-name ?) ?))
|
(gestalt-union (sub (timer-expired (timer-name ?) ?))
|
||||||
(sub (tcp-packet #t src-ip src-port dst-ip dst-port ? ? ? ? ? ?))
|
worldward-facing-gestalt
|
||||||
(pub (tcp-packet #f dst-ip dst-port src-ip src-port ? ? ? ? ? ?))
|
appward-facing-gestalt))
|
||||||
(sub (tcp-channel dst src ?))
|
|
||||||
(if (not (buffer-finished? (conn-state-inbound s)))
|
|
||||||
(pub (tcp-channel src dst ?))
|
|
||||||
(gestalt-empty))
|
|
||||||
(pub (tcp-channel src dst ?) #:level 1)))
|
|
||||||
|
|
||||||
;; ConnState -> Transition
|
;; ConnState -> Transition
|
||||||
(define (deliver-inbound-locally s)
|
(define (deliver-inbound-locally s)
|
||||||
|
@ -411,19 +417,20 @@
|
||||||
|
|
||||||
;; Boolean SeqNum -> ConnState -> Transition
|
;; Boolean SeqNum -> ConnState -> Transition
|
||||||
(define ((discard-acknowledged-outbound ack? ackn) s)
|
(define ((discard-acknowledged-outbound ack? ackn) s)
|
||||||
(transition
|
(if (not ack?)
|
||||||
(if (not ack?)
|
(transition s '())
|
||||||
s
|
(let* ((b (conn-state-outbound s))
|
||||||
(let* ((b (conn-state-outbound s))
|
(limit (seq+ (buffer-seqn b) (bit-string-byte-count (buffer-data b))))
|
||||||
(limit (seq+ (buffer-seqn b) (bit-string-byte-count (buffer-data b))))
|
(ackn (if (seq> ackn limit) limit ackn))
|
||||||
(ackn (if (seq> ackn limit) limit ackn))
|
(dist (seq- ackn (buffer-seqn b))))
|
||||||
(dist (seq- ackn (buffer-seqn b))))
|
(define remaining-data (bit-string-drop (buffer-data b) (* dist 8))) ;; bit offset!
|
||||||
(define remaining-data (bit-string-drop (buffer-data b) (* dist 8))) ;; bit offset!
|
(define new-s (struct-copy conn-state s
|
||||||
(struct-copy conn-state s
|
[outbound (struct-copy buffer b [data remaining-data] [seqn ackn])]
|
||||||
[outbound (struct-copy buffer b [data remaining-data] [seqn ackn])]
|
[syn-acked? (or (conn-state-syn-acked? s)
|
||||||
[syn-acked? (or (conn-state-syn-acked? s)
|
(positive? dist))]))
|
||||||
(positive? dist))])))
|
(transition new-s
|
||||||
'()))
|
(when (and (not (conn-state-syn-acked? s)) (positive? dist))
|
||||||
|
(routing-update (compute-gestalt new-s)))))))
|
||||||
|
|
||||||
;; Nat -> ConnState -> Transition
|
;; Nat -> ConnState -> Transition
|
||||||
(define ((update-outbound-window peer-window) s)
|
(define ((update-outbound-window peer-window) s)
|
||||||
|
|
Loading…
Reference in New Issue