Handle incoming RST
This commit is contained in:
parent
4451795146
commit
0a5abb8fff
10
tcp.rkt
10
tcp.rkt
|
@ -551,14 +551,18 @@
|
||||||
(define expected (next-expected-seqn s))
|
(define expected (next-expected-seqn s))
|
||||||
(define is-syn? (set-member? flags 'syn))
|
(define is-syn? (set-member? flags 'syn))
|
||||||
(define is-fin? (set-member? flags 'fin))
|
(define is-fin? (set-member? flags 'fin))
|
||||||
(if (and (not expected) ;; no syn yet
|
(cond
|
||||||
|
[(set-member? flags 'rst)
|
||||||
|
(transition s (quit))]
|
||||||
|
[(and (not expected) ;; no syn yet
|
||||||
(or (not is-syn?) ;; and this isn't it
|
(or (not is-syn?) ;; and this isn't it
|
||||||
(and (not (conn-state-listener-listening? s)) ;; or it is, but no listener...
|
(and (not (conn-state-listener-listening? s)) ;; or it is, but no listener...
|
||||||
(not (conn-state-local-peer-seen? s))))) ;; ...and no outbound client
|
(not (conn-state-local-peer-seen? s))))) ;; ...and no outbound client
|
||||||
(reset ackn ;; this is *our* seqn
|
(reset ackn ;; this is *our* seqn
|
||||||
(seq+ seqn (+ (if is-syn? 1 0) (if is-fin? 1 0)))
|
(seq+ seqn (+ (if is-syn? 1 0) (if is-fin? 1 0)))
|
||||||
;; ^^ this is what we should acknowledge...
|
;; ^^ this is what we should acknowledge...
|
||||||
s)
|
s)]
|
||||||
|
[else
|
||||||
(sequence-transitions (cond
|
(sequence-transitions (cond
|
||||||
[(not expected) ;; haven't seen syn yet, but we know this is it
|
[(not expected) ;; haven't seen syn yet, but we know this is it
|
||||||
(incorporate-segment data (set-inbound-seqn (seq+ seqn 1) s))]
|
(incorporate-segment data (set-inbound-seqn (seq+ seqn 1) s))]
|
||||||
|
@ -572,7 +576,7 @@
|
||||||
(update-outbound-window window)
|
(update-outbound-window window)
|
||||||
(send-outbound old-ackn)
|
(send-outbound old-ackn)
|
||||||
bump-activity-time
|
bump-activity-time
|
||||||
quit-when-done))]
|
quit-when-done)])]
|
||||||
[(message (tcp-channel _ _ bs) _ _)
|
[(message (tcp-channel _ _ bs) _ _)
|
||||||
;; (log-info "GOT MORE STUFF TO DELIVER ~v" bs)
|
;; (log-info "GOT MORE STUFF TO DELIVER ~v" bs)
|
||||||
(sequence-transitions (transition (struct-copy conn-state s
|
(sequence-transitions (transition (struct-copy conn-state s
|
||||||
|
|
Loading…
Reference in New Issue