|
Lines 582-594
TcpSocketBase::Bind (const Address &address)
|
Link Here
|
|---|
|
| 582 |
} |
582 |
} |
| 583 |
|
583 |
|
| 584 |
void |
584 |
void |
| 585 |
TcpSocketBase::InitializeCwnd (void) |
|
|
| 586 |
{ |
| 587 |
m_tcb->m_cWnd = GetInitialCwnd () * GetSegSize (); |
| 588 |
m_tcb->m_ssThresh = GetInitialSSThresh (); |
| 589 |
} |
| 590 |
|
| 591 |
void |
| 592 |
TcpSocketBase::SetInitialSSThresh (uint32_t threshold) |
585 |
TcpSocketBase::SetInitialSSThresh (uint32_t threshold) |
| 593 |
{ |
586 |
{ |
| 594 |
NS_ABORT_MSG_UNLESS ( (m_state == CLOSED) || threshold == m_tcb->m_initialSsThresh, |
587 |
NS_ABORT_MSG_UNLESS ( (m_state == CLOSED) || threshold == m_tcb->m_initialSsThresh, |
|
Lines 618-637
TcpSocketBase::GetInitialCwnd (void) const
|
Link Here
|
|---|
|
| 618 |
return m_tcb->m_initialCWnd; |
611 |
return m_tcb->m_initialCWnd; |
| 619 |
} |
612 |
} |
| 620 |
|
613 |
|
| 621 |
void |
|
|
| 622 |
TcpSocketBase::ScaleSsThresh (uint8_t scaleFactor) |
| 623 |
{ |
| 624 |
m_tcb->m_ssThresh <<= scaleFactor; |
| 625 |
} |
| 626 |
|
| 627 |
/* Inherit from Socket class: Initiate connection to a remote address:port */ |
614 |
/* Inherit from Socket class: Initiate connection to a remote address:port */ |
| 628 |
int |
615 |
int |
| 629 |
TcpSocketBase::Connect (const Address & address) |
616 |
TcpSocketBase::Connect (const Address & address) |
| 630 |
{ |
617 |
{ |
| 631 |
NS_LOG_FUNCTION (this << address); |
618 |
NS_LOG_FUNCTION (this << address); |
| 632 |
|
619 |
|
| 633 |
InitializeCwnd (); |
|
|
| 634 |
|
| 635 |
// If haven't do so, Bind() this socket first |
620 |
// If haven't do so, Bind() this socket first |
| 636 |
if (InetSocketAddress::IsMatchingType (address) && m_endPoint6 == 0) |
621 |
if (InetSocketAddress::IsMatchingType (address) && m_endPoint6 == 0) |
| 637 |
{ |
622 |
{ |
|
Lines 706-713
TcpSocketBase::Listen (void)
|
Link Here
|
|---|
|
| 706 |
{ |
691 |
{ |
| 707 |
NS_LOG_FUNCTION (this); |
692 |
NS_LOG_FUNCTION (this); |
| 708 |
|
693 |
|
| 709 |
InitializeCwnd (); |
|
|
| 710 |
|
| 711 |
// Linux quits EINVAL if we're not in CLOSED state, so match what they do |
694 |
// Linux quits EINVAL if we're not in CLOSED state, so match what they do |
| 712 |
if (m_state != CLOSED) |
695 |
if (m_state != CLOSED) |
| 713 |
{ |
696 |
{ |
|
Lines 1184-1207
TcpSocketBase::DoForwardUp (Ptr<Packet> packet, const Address &fromAddress,
|
Link Here
|
|---|
|
| 1184 |
|
1167 |
|
| 1185 |
ReadOptions (tcpHeader); |
1168 |
ReadOptions (tcpHeader); |
| 1186 |
|
1169 |
|
| 1187 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
1170 |
if (tcpHeader.GetFlags () & TcpHeader::SYN) |
| 1188 |
{ |
|
|
| 1189 |
EstimateRtt (tcpHeader); |
| 1190 |
} |
| 1191 |
|
| 1192 |
// Update Rx window size, i.e. the flow control window |
| 1193 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
| 1194 |
{ |
| 1195 |
UpdateWindowSize (tcpHeader); |
| 1196 |
} |
| 1197 |
else if (tcpHeader.GetFlags () & TcpHeader::SYN) |
| 1198 |
{ |
1171 |
{ |
| 1199 |
/* The window field in a segment where the SYN bit is set (i.e., a <SYN> |
1172 |
/* The window field in a segment where the SYN bit is set (i.e., a <SYN> |
| 1200 |
* or <SYN,ACK>) MUST NOT be scaled (from RFC 7323 page 9). But should be |
1173 |
* or <SYN,ACK>) MUST NOT be scaled (from RFC 7323 page 9). But should be |
| 1201 |
* saved anyway.. |
1174 |
* saved anyway.. |
| 1202 |
*/ |
1175 |
*/ |
| 1203 |
m_rWnd = tcpHeader.GetWindowSize (); |
1176 |
m_rWnd = tcpHeader.GetWindowSize (); |
|
|
1177 |
|
| 1178 |
m_tcb->m_cWnd = GetInitialCwnd () * GetSegSize (); |
| 1179 |
m_tcb->m_ssThresh = GetInitialSSThresh (); |
| 1204 |
} |
1180 |
} |
|
|
1181 |
else if (tcpHeader.GetFlags () & TcpHeader::ACK) |
| 1182 |
{ |
| 1183 |
EstimateRtt (tcpHeader); |
| 1184 |
UpdateWindowSize (tcpHeader); |
| 1185 |
} |
| 1186 |
|
| 1205 |
|
1187 |
|
| 1206 |
if (m_rWnd.Get () == 0 && m_persistEvent.IsExpired ()) |
1188 |
if (m_rWnd.Get () == 0 && m_persistEvent.IsExpired ()) |
| 1207 |
{ // Zero window: Enter persist state to send 1 byte to probe |
1189 |
{ // Zero window: Enter persist state to send 1 byte to probe |
|
Lines 3101-3107
TcpSocketBase::ReadOptions (const TcpHeader& header)
|
Link Here
|
|---|
|
| 3101 |
{ |
3083 |
{ |
| 3102 |
m_winScalingEnabled = true; |
3084 |
m_winScalingEnabled = true; |
| 3103 |
ProcessOptionWScale (header.GetOption (TcpOption::WINSCALE)); |
3085 |
ProcessOptionWScale (header.GetOption (TcpOption::WINSCALE)); |
| 3104 |
ScaleSsThresh (m_rcvWindShift); |
|
|
| 3105 |
} |
3086 |
} |
| 3106 |
} |
3087 |
} |
| 3107 |
} |
3088 |
} |