X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..143464d58d2bd6378e74eec636961ceb0d32fb91:/bsd/netinet/tcp_output.c diff --git a/bsd/netinet/tcp_output.c b/bsd/netinet/tcp_output.c index 8c58a9bfc..fa6e5348c 100644 --- a/bsd/netinet/tcp_output.c +++ b/bsd/netinet/tcp_output.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * Copyright (c) 2000-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -854,6 +854,7 @@ after_sack_rexmit: recwin = tcp_sbspace(tp); + /* * If the socket is capable of doing unordered send, * pull the amount of data that can be sent from the @@ -992,8 +993,8 @@ after_sack_rexmit: * If our state indicates that FIN should be sent * and we have not yet done so, then we need to send. */ - if (flags & TH_FIN && - ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una)) + if ((flags & TH_FIN) && + (!(tp->t_flags & TF_SENTFIN) || tp->snd_nxt == tp->snd_una)) goto send; /* * In SACK, it is possible for tcp_output to fail to send a segment @@ -1800,7 +1801,8 @@ send: if (flags & (TH_SYN|TH_FIN)) { if (flags & TH_SYN) tp->snd_nxt++; - if (flags & TH_FIN) { + if ((flags & TH_FIN) && + !(tp->t_flags & TF_SENTFIN)) { tp->snd_nxt++; tp->t_flags |= TF_SENTFIN; } @@ -1832,7 +1834,8 @@ send: timer: if (tp->t_timer[TCPT_REXMT] == 0 && ((sack_rxmit && tp->snd_nxt != tp->snd_max) || - tp->snd_nxt != tp->snd_una)) { + tp->snd_nxt != tp->snd_una || + (flags & TH_FIN))) { if (tp->t_timer[TCPT_PERSIST]) { tp->t_timer[TCPT_PERSIST] = 0; tp->t_rxtshift = 0; @@ -1849,7 +1852,8 @@ timer: int xlen = len; if (flags & TH_SYN) ++xlen; - if (flags & TH_FIN) { + if ((flags & TH_FIN) && + !(tp->t_flags & TF_SENTFIN)) { ++xlen; tp->t_flags |= TF_SENTFIN; }